« »
10/10/2009

PHP preg_replace the Javascript equivalent

It's seems that preg_replace (and apparently preg_replace_callback) doesn't exist in PHP.js or any other javascript library, however after some research I've found this one from Ferdinand Silva:



And this one from Xuan NGUYEN:


Problems
But their function don't support references (of the form \\n or (since PHP 4.0.4) $n or ${n}) in the remplacement argument . So I've developped mine !


Check my GitHub page for the PHP preg_replace Javascript Equivalent
« »
 
 
Made with on a hot august night from an airplane the 19th of March 2017.