OK, you're looking at an example sentence, with ample words to use as an example :-) Notice the use of the word ample here.
suppose I want to make ample bold but not ample in EXample. I know how to do the regular expression:
/\s+ample(\s+|$)/i
However if I do this:
$regex='/\s+(ample)\s+/i';
$str="OK, you're looking at an example sentence, with ample words to use as an example :-) Notice the use of the word ample here.";
$str=preg_replace($regex,'<b>ample</b>',$str);
There are two problems:
1. I'm going to munch the whitespace on either end
2. I'm going to walk over the case of the word Ample or AMPLE.
I know this is with backreferences or some such term, any assistance on this? Thank you,
Samuel Fullman