JQuery and RegExr Help :|

Status
Not open for further replies.

Porsche_maniak

Active Member
283
2009
0
40
Hi guys.
I have really big difficulties of doing the following so any help would be appreciated.

Here's my stack
Code:
[B]$(document).[COLOR="Red"]test(1000)[/COLOR].mouseover(function(){
alert(1[COLOR="Blue"]);[/COLOR] alert(2[COLOR="blue"]);[/COLOR]
}[COLOR="Blue"]);[/COLOR][/B]

$(document).inbetween();
[B]$(document).[COLOR="red"]test(2000)[/COLOR].mouseover(function(){alert(1); alert(2);});[/B]

Ok so i want to take the functions(that are bold) with regexr that contain test() function attached. It must work in all major browsers + IE6.

I have the following pattern but can't do it good enough to work.
\$\(.*\)\.test\(\d*\)\.(?:\r|\n|.)+\);(?:\$)+

Thanks

EDIT: Ok i found the proper pattern guys. It's :
\$\(.*\)\.test\(\d*\)\.[^\$]*
 
Last edited:
4 comments
well regarding the pattern, I don't really see why (?:\$)+ is at the end, it means 'at least one dollar sign after the ;' and maybe you need to make the '.' non-greedy by adding question marks: \$\(.*?\)\.test\(\d*\)\.(?:\r|\n|.)+?\);
 
Yes i know that (?:\$)+ is not correct. But i think thats the only way delimiter for the next match.. or maybe you are close ?
The thing is that if i have a function or something that ends with ); inside the mouseover function the regex doesn't work as expected.Your pattern matches till the first occurance of );
but it should be to the last. How to do this?
 
Last edited:
Status
Not open for further replies.
Back
Top