Sunday, May 12, 2024
 Popular · Latest · Hot · Upcoming
11
rated 0 times [  18] [ 7]  / answers: 1 / hits: 18298  / 11 Years ago, mon, may 6, 2013, 12:00:00

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



I am having an issue with this regex. from PHP



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


used like this



preg_replace('/(d*)|/(P)//', '', $string);


how can I convert this to work on JS ?



str.replace();


Thank you in advance


More From » php

 Answers
3

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.


[#78408] Saturday, May 4, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
matteo

Total Points: 81
Total Questions: 100
Total Answers: 96

Location: Honduras
Member since Sat, Jul 24, 2021
3 Years ago
;