<a href="e;some.php"e;>Click
Here</a>
<script type="e;text/javascript"e;>
var re = new RegExp("e;<a href=\"e;(.*?)\"e;>Click Here<\/a>"e;,"e;is"e;);
var result = re.exec(document.body.innerHTML);
alert(resultї1]);
</script>
Whats confusing is there is no alert() msg box AND there no msg in the FireFox's JavaScript Console. If there was some msg in the JavaScript Console I could have done something.
Anyone know what am I doing wrong here ?
Thanks
Last edited by anjanesh on Wed May 18, 2005 1:49 pm, edited 1 time in total.
Well Javascript's regex implementation is pretty poor unfortunately.
There is no such "s" modifier in JS (we use "g" instead), also... make sure you put the <script> tags with this code after the body or it'll be undefined.
One last point. With the JS exec() method, if you want a preg_match_all() equivalent you need to use a while loop.
<html>
<head></head>
<body>
<a href="e;some.php"e;>Click
Here</a>
<script type="e;text/javascript"e;>
var re = new RegExp("e;<a href=\"e;(.*?)\"e;>Click Here<\/a>"e;,"e;ig"e;);
var result = re.exec(document.body.innerHTML);
alert(result);
alert(document.getElementsByTagName("e;a"e;)ї0].innerHTML);
</script>
</body>
</html>
There is no such "s" modifier in JS
Thats strange. I was referring to this and according to it g,i,s,m,x modifiers exist.