Hi guys,
Been working on a bit of of regex to locate exact word matches but having some problems due to the lack of support look behind was wondering if anyone could help me nail the final issue in this expression:
In the following array it makes the following matches (in bold):
All are correct except the one with a hyphen before the "foo" - I don't want to be getting a match on "bar-foo" but everything I try seems to break it.
Assistance much appreciated.
Been working on a bit of of regex to locate exact word matches but having some problems due to the lack of support look behind was wondering if anyone could help me nail the final issue in this expression:
Code:
sTest = new RegExp(/\bfoo(?![-])\b/);
Code:
{'[B]foo[/B]', 'bar [B]foo[/B]', '[B]foo[/B] bar', 'foo-bar', 'bar-[B]foo[/B]', 'foo_bar', 'bar_foo'}
Assistance much appreciated.
Comment