1 |
String object methods have been added to JavaScript 1.2 to handle regular expressions -- consider an ordinary string ordstr
-
ordstr.search( regexp ); // like test(...)and equivalent to ordstr =~ m/regexp/ in PERL returns true or false
-
ordstr.match( regexp ); // like exec(...)and returns a results array as described for exec
-
newstr = oldstr.replace( regexp, newsubstr ); // equivalent to ordstr =~ s/regexp/newsubstr/ in PERL but returns a new string -- leaving original unchanged
|