in reply to Re: Regular Expression gotchas ?
in thread Regular Expression gotchas ?
Please run the code below and see if you get the same output as I do (also below). If so, I would like to know why it is behaving as it is.
#!/usr/local/perl -w use strict; my $filename1 = 'FILE.pgp'; my $filename2 = 'FILE.gpg'; my $signer = 'Some person <someone@this.com>'; my $exp_sender= ''; my $new_filename1 = $filename1; $new_filename1 =~ s/(\.gpg)|(\.encrypted)/\.decrypted/; print ".PGP FILE ERROR:'$signer' is not '$exp_sender'.\n" unless ($signer =~ m/\Q$exp_sender\E/); my $new_filename2 = $filename2; $new_filename2 =~ s/(\.gpg)|(\.encrypted)/\.decrypted/; print ".GPG FILE ERROR:'$signer' is not '$exp_sender'.\n" unless ($signer =~ m/\Q$exp_sender\E/); my $new_filename3 = $filename1; $new_filename3 =~ s/(\.gpg)|(\.encrypted)/\.decrypted/; print ".PGP ERROR, why the second time but not the first?:'$signer' is + not '$exp_sender'.\n" unless ($signer =~ m/\Q$exp_sender\E/); 1;
And below is the out put I get from the above script
$ perl match_test.pl .GPG FILE ERROR:'Some person <someone@this.com>' is not ''. .PGP ERROR, why the second time but not the first?:'Some person <someo +ne@this.com>' is not ''.
the_Don
...making offers others can't rufuse.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Regular Expression gotchas ?
by hv (Prior) on Feb 17, 2003 at 13:43 UTC | |
by the_Don (Scribe) on Feb 18, 2003 at 22:18 UTC | |
by hv (Prior) on Feb 18, 2003 at 22:50 UTC |