in reply to Defining Characters in Word Boundary?
/\b/ is equivalent to /(?<=\w)(?!\w)|(?<!\w)(?=\w)/. Feel free to replace \w with a character class.
It would be tedious to have to write \\$keyword([^a-zA-Z]) and then have to substitute back $1 (because I do not want it eaten).
Don't eat it if you don't want add it back. Equivalent without eating:
\\$keyword(?=[^a-zA-Z])
But you surely meant
\\$keyword(?![a-zA-Z])
In general, it's easier to extract the keyword, then check if it's the one you want.
\\([a-zA-Z]+)
|
|---|