Hi,
I'm trying to bold all the percentage amounts in a $string.
My intention is do to a pattern match and then preappend and postappend the string with <b> and </b>.
Is this possible?
lli2k5 wrote:Is this possible?
Definitely! [man]preg_replace/man sounds like the way to go here.
how do you allocate that the replacement string is actually the pattern itself? Or would there have to be a table of replacement strings.
$newstring = preg_replace('/([0-9,\.]+ ?%)/', '<b>$1</b>', $oldstring);
Thanks, never knew about that.