\b matches before bar \w+ matches "bar" \s* matches as many spaces as it can swallow (it's greedy), i.e. " " (road)? matches "road" but \b matches before bar \w+ matches "bar" \s*? matches the *empty* string (it isn't greedy) so (road)? attempts to match " road" - which of course fails
In reply to Re: Regex lazy behaviour
by ELISHEVA
in thread Regex lazy behaviour
by abhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |