You did a case sensitive match for "Smith", so it correctly skipped over "smith".
You can try m{$search_term}i instead, for case ignoring matching.
umm... yes. That was supposed to be a code example that one might use when posting in SoPW... So often there are questions that are unclear.
When you have all 3 aspects of the problem
- real code that demonstrates the problem
- Expected Output
- Actual Output the OP recieves
its far easier to figure out what they are trying to do and where they have come unstuck...
BTW Do you have anything against slashes for regular expressions?
No, not really, I just prefer using curlies. Each to their own I guess...
Changing it without reason is unnecessarily obfuscating.
I see your point.
Update: Addressed
bart's second point.