preg_replace: Regular Expression question
Posted: Tue May 20, 2008 5:07 pm
If I have the following string:
How would I go about setting up the regular expression so I can only replace between the ( ) brackets?
The basic pattern would be something like:
I'd appreciate any help, thx!
Code: Select all
$string = "John went all-in after he saw the flop (7s 8c 9d) and feels good about it.";The basic pattern would be something like:
Code: Select all
preg_replace('/7s/', 'Seven of Spades', $string);