开发者

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".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜