How to convert PHP regex to JavaScript regex

前端 未结 1 1023
别跟我提以往
别跟我提以往 2020-11-30 12:16

I am currently porting my web app codes from PHP to JS.

I am having an issue with this regex. from PHP

/\\(\\d*\\)|\\/\\(P\\)\\//

u

相关标签:
1条回答
  • 2020-11-30 13:04

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

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

    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.

    0 讨论(0)
提交回复
热议问题