Hello all,
I understand that .match() returns an array of the matches, or null if none are found. But how do I go about accessing the values of capturing groups used with .match?
For example:
var val = whatever.match('(?:^|;) ?' + stuff + '=([^;]*)(?:;|$)');
Assuming the regular expression matches more than once, how do I access th...
Hi,
i have found this:
$text = preg_replace('/\W+/', '-', $text);
Anyone can tell me what exactly do that? There is no information about what '/\W+/' means..
Regards
Javi
...
I have a goal set up that is roughly as follows:
product page -> first page order form -> second page order form -> thank you page
I have checked the regex for all of the above by searching the filters in Top Content and have checked over all of them a few times.
On the funnel visualization page, every number listed is zero. On the go...
Suppose you want to match text that is delimited by double characters like so:
a = <<
Hello
World!
>>
The regular expression /<<(.*)>>/ would seem to do it, but unfortunately when these can be repeated greedy matching gets too much:
a = <<
Hello
World!
>>
b = <<
Goodbye
World!
>>
The previous regexp will capture
Hello
World!
>>
...
Hi,
I need to clean a string and make sure it contains alpha numeric characters only. I've come up with the following code that for some reason fails
$string = 'aaa`bbb!!';
$string = preg_replace("#[^a-zA-z0-9]*#", "", $string);
echo $string;die;
The output I receive is aaa`bbb while I expect aaabbb. Could you please h...
Here is an example of the type of text file I am trying to search (named usefile):
DOCK onomatopoeia
DOCK blah blah
blah DOCK blah
DOCK
blah blah blah
onomatopoeia
blah blah blah
blah blah DOCK
DOCK blah blah
DOCK blah
onomatopoeia
I am using a finditer statement to find everything between DOCK and onomatopoeia as follows:
re.finditer...
I'm trying to extract the users who ask questions on a classified ad website(http://trademe.co.nz/Trade-Me-Motors/Cars/Toyota/Hiace/auction-300294634.htm) . For some reasons the pattern which I'm using is not working always so I would appreciate if you will help me with a perfect regex
Here is my current code
/get memberid of the que...
Hello,I want to match text inside double quotes and bracket as two groups by use regex, How can I do that?
from
“作為”(act) ,用於罪行或民事過失時,包括一連串作為、任何違法的不作為和一連串違法的不作為;
“行政上訴委員會”(Administrative Appeals Board) 指根據《行政上訴委員會條例》(第442章)設立的行政上訴委員會;(由1994年第6號第32條增補)
“成人”、“成年人”(adult)* 指年滿18歲的人; (由1990年第32號第6條修訂)
“飛機”、“航空器”(aircraft) 指任何可憑空氣的反作用而在大氣中獲...
I am trying to parse the keywords from google suggest, this is the url:
http://google.com/complete/search?output=toolbar&q=test
I've done it with php using:
'|<CompleteSuggestion><suggestion data="(.*?)"/><num_queries int="(.*?)"/></CompleteSuggestion>|is'
But that wont work with python re.match(pattern, string), I tried a few b...
I'm trying to parse a file that contains blocks of text in this format(there can be 1-n of these):
-----------------------------------------------------------
KB Article Number(s): 2028769, 2072493, 2120979, 2143880, 2163958, 2163980, 980653, 980883, 981155, 981867, 982321, 982850
Language: All (Global)
Platform: x64
Location: (http://f...
Hi, i want to extract 34 from this string. How Can i done that ? (i will use javascript)
#project_maincategory=3&project_subcategory=34&project_tags[]=70&project_tags[]=71&created_in=30
...
Hello,
i need to replace upper case letter in variable name with lower case letter and add space
For example:
"NotImplementedException" should be "Not implemented exception"
"UnhandledException" should be "Unhandled exception"
Thanks
...
Could someone give me an example of how to I can remove
[QUOTE=author;3095231]
Author being the authors name, and 3095231 being the post.
I want to use preg replace, or anything similar but not sure how and was wondering for an example, I believe it would be something like [QUOTE=(.+?)]
and i don't know the rest.
...
Hi,
I have this at the moment, (I found the code on here).
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
someText.replace(exp, "<a href='$1'>$1</a>");
It will replace any http://URL in someText with a proper <a href>
But i also require it to match www. without the http. I found ...
We have a textbox which accepts comma separated email address. The regular expression is
^(\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*\s*[,]?\b)*$.
However now I am unable to add a length validation to this expression. Each email address should not be more than 150 characters. I have tried
^((\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-....
I'm reading Sitepoints 2007 book "Simply Javascript" and I encountered some code I just can't understand.
It's the following code:
Core.removeClass = function(target, theClass)
{
var pattern = new RegExp("(^| )" + theClass + "( |$)");
target.className = target.className.replace(pattern, "$1");
target.className = target.clas...
i have tried below given expressions.
(http:\/\/.*?)['\"\< \>]
(http:\/\/[-a-zA-Z0-9+&@#\/%?=~_|!:,.;\"]*[-a-zA-Z0-9+&@#\/%=~_|\"])
the first one is doing well but always gives the last extra character with the matched urls .
Eg:
http://domain.com/path.html"
http://domain.com/path.html<
Notice
" <
I don't want them with ...
I have a string which can contain multiple matches (any word surrounded by percentage marks) and an array of replacements - they key of each replacement being the match of the regex. Some code will probably explain that better...
$str = "PHP %foo% my %bar% in!";
$rep = array(
'foo' => 'does',
'bar' => 'head'
);
The desired result ...
I have a string that I need to split on a certain character. However, I only need to split the string on one of those characters when it is flanked by digits. That same character exists in other places in the string, but would be flanked by a letter -- at least on one side. I have tried to use the split function as follows (using "x" ...
I'm new to regular expressions and grep, but I've been trying to learn it to help me when using console tools.
I have to use cvs, and when I update some files, I don't need to see files that were't updated or with *.pyc extension for example. So, I created a script that calls:
cvs update -d | grep -v 'pyc$' | grep -v '^\?'
First ques...