Reputation: 7734
I have following java script regular expression which i need to convert to similar php converter.
text = text.replace(/R/g, "ූ");
Can someone help me to convert this into PHP ?
Upvotes: 0
Views: 79
Reputation: 2132
its regex counterpart in php will be :
preg_replace( '/R/', 'your replacement string', $text );
$text = the value of 'text' in your javascript code.
However, for simple text replace, regular expressions are expensive. If your problem can't be solved using simple string functions then only use regex.
Upvotes: 1
Reputation: 91385
It's very similar:
$text = preg_replace('/R/', "ූ", $text);
Have look at the preg_replace documentation.
Upvotes: 1