You might still look at \b. It's a zero width assertion that there's a word boundary there. Which means it's pretty much exactly like the other solution I gave except for three aspects:
- It's based on the difference between \w and \W, not between \s and \S (that is, it will detect a boundary after "qwe" in "qwe-rty")
- If your $pattern begins or ends with a non-word character, a \b will assert that it's next to a word character (while the solution based on \s will still assert that there is a space next to it
- Finally, and possibly most importantly, it will also match at the begining and end of the string. If you want the other to work there, you'll have to add spaces to the begining and end.
Probably none of that is all that imporant, but it's often very useful in cases like this. | [reply] [d/l] [select] |