So I want to find the string “to” in a string, but only when it is standalone. It could be at the beginning of the string, as in “to do this”, so I can’t search ” to “.
What I want to do is say, if there is a character behind “to”, it cannot be \w. How do I do that?
Try word boudaries. It matches the beginning and the end of the searched pattern
This is exaclty what you want to say, i.e.
Sams Teach Yourself Regular Expressions in 10 Minutes
By Ben Forta