更新时间:2023-12-04 14:02:10
你应该改用它......
You should use this instead...
new RegExp("\\btest[a-z]*", "g");
...如 \b
将当JavaScript解析器通过相应的字符串文字工作时,可以插入到单(无斜线)字符中。解决方案是逃避斜线本身。
... as \b
will be interpolated into a single (slashless) character when JavaScript parser works through the corresponding string literal. The solution is to escape slash itself.