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*'.
In reply to Re^2: search for exact string
by oko1
in thread search for exact string
by gfarhat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |