in reply to Search operator and * quantifier

The overriding principle of the regex engine is that it searches for the left-most possible match of the regex. And the left-most possible match for your regex is the empty string (zero digits) at the start of the string.

If you don't want that to happen, use the + quantifier instead (one or more matches).

Replies are listed 'Best First'.
Re^2: Search operator and * quantifier
by Anonymous Monk on Jun 20, 2012 at 16:50 UTC
    Thank you!
Re^2: Search operator and * quantifier
by gg48gg (Sexton) on Jun 21, 2012 at 04:39 UTC
    I think the regex engine starts at ^ (start of the string), which matches the 1-5*, so it stops. I think the best regex turorial and reference is: http://www.regular-expressions.info/reference.html