Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Javascript regex backrefering

Name: Anonymous 2012-02-22 12:29

In Perl, this will successfully backreference TeXt.


  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?

Name: Anonymous 2012-02-22 15:46

Why fuck around with Javascript when you can learn D?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List