Name: Anonymous 2012-02-22 12:29
In Perl, this will successfully backreference TeXt.
However, if I try something similar in Javascript:
This will not backreference TeXt
Any idea how I can access the captured group within the If block in Javascript?
my $str = "this is TeXt";;
if ( str =~ /(TeXt)/g ) ) {
$str = $1;
}However, if I try something similar in Javascript:
var str = "this is TeXt";;
if ( str.match(/(TeXt)/g) ) {
str = $1;
}This will not backreference TeXt
Any idea how I can access the captured group within the If block in Javascript?