cyberpine
12-08-2009, 08:45 PM
Why do I get both the greedy and non-greedy? How do I extract "somestring" only? I'm on IE7.
thanks
<script type="text/javascript">
var x = "(EVAL)(H:somestring)Some other Text here";
var full =(x.match(/\(H\:(.*?)\)/g)); // produces "(H:somestring)" as expected
alert(full);
var inside = (x.match(/\(H\:(.*)\)/)); // produces "(H:somestring),somestring" .. I only
want "somestring"
alert(inside);
</script>
thanks
<script type="text/javascript">
var x = "(EVAL)(H:somestring)Some other Text here";
var full =(x.match(/\(H\:(.*?)\)/g)); // produces "(H:somestring)" as expected
alert(full);
var inside = (x.match(/\(H\:(.*)\)/)); // produces "(H:somestring),somestring" .. I only
want "somestring"
alert(inside);
</script>