Hello,
I am trying to match HTML tags that might occur between words on a web page, using regex's.
For example, if the sentence that I want to match is "This is a word", I need to develop a pattern that will match something like "This is a <b>word</b>".
I've tried using the code below to prepare the regex pattern:
$pattern = "/".str_...
I am using the following regex
html.scan(Regexp.new(/Name:<\/td>(.*?)<\/td>/s))
to match the name [ Burkhart, Peterson & Company ] in this
<td class="generalinfo_left" align="right">Name:</td>
<td class="generalinfo_right">Burkhart, Peterson & Company</td>
...
I've delved into Regular Expressions for one of the first times in order to a parse a url. Without going into too much depth, I basically want friendly urls and I'm saving each permalink in the database, but because of differences in languages and pages I only want to save one permalink and parse the url for the page and language. So if ...
I need to parse the domain name from a string. The string can vary and I need the exact domain.
Examples of Strings:
http://somename.de/
www.somename.de/
somename.de/
somename.de/somesubdirectory
www.somename.de/?pe=12
I need it in the following format with just the domain name, the tld, and the www, if applicable:
www.somename.de...
Hi guys I am looking for a regular expression which will not match any given string that is exactly equal to a few keywords I will determine manually.
The purpose is to edit my urlrewrite.xml which can accept regexps in following format
<rule>
<from>^/location/([A-Z]+)/name/([A-Z]+)</from>
<to>/login?name=$2&location=$1</to>...
Hi guys..
I have been working on my date regular expression all day...
I want a date format to be YYYY-MM-DD.
$date_regex ='^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$';
if (preg_match($date_regex, $dateString)) {
echo "good format";
}
keeps giving me error
preg_match() [function.preg-match]: No e...
I am modifying some HTML pages and want to increase the font size dynamically with a regex. In my script below, I want the '8' and '3' to turn into '9' and '4' but I get '8++' and '3++', respectively. I have the following:
#!/usr/bin/perl
use warnings;
use LWP::Simple;
my $content = "<TD><FONT STYLE=\"font-family:Verdana, Geneva, sans-...
In perl you can write
$string =~ tr/[a,e,i,o,u,y]/[A,E,I,O,U,Y]/;
for example.
Is it possible to achieve the same "translation" effects with VB.Net regexes?
Thanks you!
PS: I'm not searching for a way to port this very example, it's more of a curiosity question :)
...
I need to use JavaScript split but I'm useless at regex so what i wanna do is take a text which is CSS like structure eg:
var str = "selector {
width: 100px;
height: 20px;
}
.anything{
margin: 5%;
}";
str.split(/regex goes here/);
Expected output
[
0 = selector{width: 100px; height: 20px;},
1 = .anything{margin: 5%;}
]
...
Say I have a long string of text, and I want to capture everytime the word this is mentioned within rounded brackets. How could I do this? The following pattern only matches the first this, ignoring every occurrence after:
/\(.*(this).*\)/g
For example, using the pattern above on the following text:
Etiam scelerisque, nunc ac egestas...
hi
i have a field called City ,
this should accepts only Characters but not special characters or numbers
can any one help with regix logic
thanks in advance
thanks
Sunny Mate
...
10 websites need to be cached. When caching: photos, css, js, etc are not displayed properly because the base domain isn't attached to the directory. I need a regex to add the base domain to the directory. examples below
base domain: http://www.example.com
the problem occurs when reading cached pages with img src="thumb/123.jpg" or src...
I have a user specified URL that has a wildcard in it, e.g. http://site.com/project/*/account
In this case * could be anything, a number, a character or anything else.
I want to get regex that would find a match for that. The location of the wildcard * changes and could be http://site.com/user/*/title or http://site.com/user/*/*/*/del...
I recently found the code below in one of my directories, in a file called doc.php. The file functions or links to a file manager. It's quite nicely done. Basically, it lists all the files in the current directory, and it lets you change directories.
It had access to all my files (add, rename, info, delete...). I don't remember installi...
Hi, I have a large malformed test HTML document which I need to get the numbers out of:
I'd like to get the primary ratio out. I'm using this regular expression:
(?<=Primary ratio</TD><TD>--</TD><TD>).*(?=</TD>)
On this string:
Primary ratio</TD><TD>--</TD><TD>10.52</TD><TD>14.97</TD><TD></TD></TR><TR align='right'><TD align='left'>...
I have a list of items that looks like this: 'Item 1', 'Item 2', 'Item 3'... with the list being dynamic in length.
My question is how can I pass this variable to my view?
Edit 1
Just thought I'd clarify what I was attempting:
return HttpResponseRedirect(reverse('newFeatures',
kwargs={'stock_number': stock_number, 'new_feature...
Hi all!
I am new to python and am using it to use nltk in my project.After word-tokenizing the raw data obtained from a webpage I got a list containing '\xe2' ,'\xe3','\x98' etc.However I do not need these and want to delete them.
I simply tried
if '\x' in a
and
if a.startswith('\xe')
and it gives me an error saying invalid \x e...
In PHP you need to use preg_quote() to escape all the characters in a string that have a particular meaning in a regular expression, to allow (in example) preg_match() to search for those special characters.
What is the equivalent in Ruby of the following code?
// The content of this variable is obtained from user input, in example.
$s...
From this article,
/^1?$|^(11+?)\1+$/ checks whether a number(its value in unary) is prime or not.
Using this, perl -l -e '(1 x $_) !~ /^1?$|^(11+?)\1+$/ && print while ++$_;' returns a list of prime numbers.
I do not have enough experience with Perl, but what I understand is that the regular expression will be true for a number that ...
// create a string
$string = '+7';
// try to match the beginning of the string
if(preg_match("{-15 to +12}", $string))
{
// if it matches we echo this line
return {strip all the + sign}
echo 'its a valid gmt time';
}
else
{
echo 'not valid gmt time';
}
Question:
please see the first {} on preg_match, ...