in reply to Re: Re: Wildcard?
in thread Wildcard?

If you've got the /s switch on though this'll happily match R\n\n\n, won't it?

Update: Oops, did wrong number of \n's. R\n\n does seem to pass this match, unless the code below is wrong..

#!/usr/bin/perl -w use strict; my @tests = ( "R\n\n", # Passes "Roo", # Passes "roo", # Fails "Roo\n", # Fails ); foreach (@tests) { if (/^R..\z$/s) { print "$_ passes\n"; } else { print "$_ fails\n"; } }

Replies are listed 'Best First'.
Re: Re: Re: Re: Wildcard?
by Juerd (Abbot) on May 30, 2002 at 13:32 UTC

    If you've got the /s switch on though this'll happily match R\n\n\n, won't it?

    No, because I also put \z there instead of $. perlre

    - Yes, I reinvent wheels.
    - Spam: Visit eurotraQ.