in reply to Re^4: Regex Inline Match operator ?m
in thread Regex Inline Match operator ?m
Have you tried the regex I suggested? Works for me:
my $tests = [ 'Nov 29 16:01:27 Nov 29 16:01:28 Nov 29 16:01:28 Nov 29 16:01:28 Nov 29 16:01:22', 'Nov 29 16:01:27 Nov 29 16:01:28 Nov 29 16:01:28 Nov 29 16:01:28 Nov 30 16:01:22' ]; foreach my $test (@$tests) { if($test =~ qr/^((^|\n)Nov 29 [^\n]*)+$/s) { print "$test\n REGEX MATCHED\n"; } else { print "$test\n FAILED!\n"; } } __END__ Nov 29 16:01:27 Nov 29 16:01:28 Nov 29 16:01:28 Nov 29 16:01:28 Nov 29 16:01:22 REGEX MATCHED Nov 29 16:01:27 Nov 29 16:01:28 Nov 29 16:01:28 Nov 29 16:01:28 Nov 30 16:01:22 FAILED!
Or modify ikegami's regex like this:
qr/^(?:Nov 29 [^\n]*(\n|$))*\z/s ^^^^^^ newline or end-of-line
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: Regex Inline Match operator ?m
by josh803316 (Beadle) on May 06, 2010 at 02:19 UTC |