You have made the road match optional. With a greedy \s* match road can be matched. If you go the minimal match route with \s*? then no white space gets matched and, because the road match is optional, road doesn't get matched either.
Actually a greedy \s* is always ok if the next thing to be matched is \S because all the white space has to match in any case.
In reply to Re: Regex lazy behaviour
by GrandFather
in thread Regex lazy behaviour
by abhy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |