Javascript Regex: PHP like Callback Variable
In PHP I ca开发者_StackOverflow中文版n get back the results from subpaterns like this:
preg_replace("/(a-z)/im", "$1", $string);
But is this possible in javascript?
Almost exactly the same way:
"foo".replace(/f(o*)/, "found: $1");
gives "found: oo".
精彩评论