in reply to Re: old Perl regex problem
in thread old Perl regex problem

     It works on 5.6.1. Someone tested it for me.
     Using the info that I put in the original post, PH-000 should not be ok. I didn't really think about that too much because I know the format of the actual files that I'm going through, but my original regex would probably be better represented with ".+" after the "PH" instead of ".*?".
Here's an actual file name: PH0022080209401500001PE-000
     BrowserUk's version would work great, but I'm reading the pattern from a configuration file and I can't change anything outside of the slashes.

Invulnerable. Unlimited XP. Unlimited Votes. I must be...
        GhodMode

Replies are listed 'Best First'.
Re: old Perl regex problem
by Abigail-II (Bishop) on Aug 02, 2002 at 14:20 UTC
    I doubt it worked under 5.6.1. Perhaps it was tested, but then the test was insufficient.
    /^PH.*?[^(H\-000)(IF\-000)]$/
    will reject any file name ending in a 0, including
    PH0022080209401500001PE-000
    yet that is a legal file name according to your specifications.
    $ /opt/perl/5.6.1/bin/perl -wle 'print "Reject" unless "PH0022080209401500001PE-000" =~ /^PH.*?[^(H\-000)(IF\-000)]$/' Reject $
    Abigail