in reply to backslash and word boundaries while matching
So don't use \b, instead look for no word character before or after: /(?<!\w)$expectedoutput(?!\w)/.
Update: as Prior Nacre V suggests, you probably want to use \Q around $expectedoutput in case of special regex characters in your variable (e.g. "."), but that won't fix your \b problems.
|
|---|