in reply to negative look-ahead is ignored

Thanks, that explains why.
So I guess there is no way to force \d{1,3} to match first 3 digits, then 2 etc ?
I also tried the following regular expression (using "2005-122-")
\d{4}-(\d{3}|\d{2}|\d)(?!-)
but I noticed (using -Mre=debug) it doesn't change anything (allthough I really thought this would do the trick :)

LuCa

Replies are listed 'Best First'.
Re^2: negative look-ahead is ignored
by Sidhekin (Priest) on Feb 19, 2007 at 10:59 UTC

    You might want to consider a negative lookahead on \d as well:

    \d{4}-\d{1,3}(?![-\d])

    Of course, this means you won't match a string like "2005-1222" either. The original would match that, and if that's intentional, you need an even trickier version:

    \d{4}-\d{1,3}(?!\d*-)

    Here's betting one of these should be what you want. :-)

    print "Just another Perl ${\(trickster and hacker)},"
    The Sidhekin proves Sidhe did it!