abstract:
my input file consists of several lines in the format:
Resource Donation March 7, 2009, 9:52 Avallach donated 150000 iron to the clan.
however, my output file simply consists of several lines of:
line doesn't match: Non-resource invalid date no words
Have I done something silly?
It's been a while since I had to do anything in perl, and I've been working in php and C++ in the meantime, so it's very possible I've done something stupid; however, I can't get my regex to report a match:
Code:- if ($line =~ /(Resource Donation)(March\s\d,\s\d\d\d\d,\s\d\d:\d\d)(\w.+)/i) {
- #rest of program here
- } else {
- print OUTPUT "line doesn't match: ";
- if ($line !~ /Resource Donation/) {
- print OUTPUT "Non-resource ";
- }
- if ($line !~ /(March\s\d,\s\d\d\d\d,\s\d\d:\d\d)/) {
- print OUTPUT "invalid date ";
- }
- if ($line !~ /(\w.+)/) {
- print OUTPUT "no words";
- }
- print OUTPUT "\n";
- }
Copy Code my input file consists of several lines in the format:
Resource Donation March 7, 2009, 9:52 Avallach donated 150000 iron to the clan.
however, my output file simply consists of several lines of:
line doesn't match: Non-resource invalid date no words
Have I done something silly? |