in reply to regex won't match with utf8 enabled...

I cannot comment on perl 5.6.1 behavior, as I don't have a copy. But this matches fine on perl 5.8.0:
use utf8; use warnings; print "matched\n" if 'pf1ad1%/pf2%2Fad2/pdad3/pfad4/filename' =~ m|^((?x-ism: [^\?]*? ))/((?x-ism: [ +^/\?]*? ))$|;
so it is possible that you have a bug in 5.6.1.

One other note: you don't need to escape '?' inside a character class. This works just as well:

use utf8; use warnings; print "matched\n" if 'pf1ad1%/pf2%2Fad2/pdad3/pfad4/filename' =~ m|^((?x-ism: [^?]*? ))/((?x-ism: [^ +/?]*? ))$|;
-Mark

Replies are listed 'Best First'.
Re: Re: regex won't match with utf8 enabled...
by Beechbone (Friar) on Sep 24, 2003 at 17:20 UTC
    Oops, sorry, I forgot to mention: I tested it under 5.8.0 myself. We all got 6.8.0 on our laptops, but the production machine will run 5.6.1 later on. And it seems, nobody tests his code very often on the development environment... ;-)

    About the escaped '?': I know, but it's maintainable code, so I prefer not to let someone guess if that ? is a ? or something special. That's also the reason for the two qr// which make up this regex. All regexes are simple and are in qr so no quoting subtles can arise...

    BTW: Thanks