I'm afraid that your solution is incorrect; "/\b$toFind(?=[^\w\.]+|$)/i" means "match, case-insensitively, a word boundary (1) followed by the content of $toFind followed by (2) EITHER one or more characters which are not 'word-building' characters or literal periods OR the end of the line" - which does not match the specification that was asked for. That is, (1) was never specified (although it was implied) and (2) is simply wrong: you used a positive look-ahead assertion where you should have used a negative look-ahead. As a result, your regex will match, e.g., 'String-' or 'string*'.

When putting a smiley right before a closing parenthesis, do you:

Use two parentheses: (Like this: :) )
Use one parenthesis: (Like this: :)
Reverse direction of the smiley: (Like this: (: )
Use angle/square brackets instead of parentheses
Use C-style commenting to set the smiley off from the closing parenthesis
Make the smiley a dunce: (:>
I disapprove of emoticons
Other