且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将PHP正则表达式转换为JavaScript正则表达式

更新时间:2022-02-13 22:09:23

没什么特别的。 PHP正则表达式语法与JavaScript非常相似:

Nothing really special. PHP regex syntax is very much the same as in JavaScript:

str = str.replace(/\(\d*\)|\/\(P\)\//g, "");

您可以在本手册中从 MDN 找到有关JavaScript中正则表达式的更多信息>: https://developer.mozilla.org/en-US/docs / JavaScript / Guide / Regular_Expressions

You can find more information about regular expressions in JavaScript in this manual from MDN: https://developer.mozilla.org/en-US/docs/JavaScript/Guide/Regular_Expressions.