in reply to Regex lazy behaviour
\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
|
|---|