Re: Regexp - alternate match and grouping



Paul Lalli wrote:
Witold Rugowski wrote:
Feb 28 00:00:00 HOSTNAME Feb 28 2006 01:00:00 HOSTNAME : %PIX-6-305011 [cut]

WTsyslog[2006-02-26 23:59:59 ip=IP_ADDRESS pri=6] <14>Feb 26 2006 23:59:59: %PIX-6-302016: [cut]


my $date_pat = qr/[a-z]{3} \d{2} \d{2}:\d{2}:\d{2}/;

Should have the /i modifier there.

my ($host_or_ip, $date);
if (/^([\w.-]+) ($date_pat)/){

Should not have the ^ anchor there.

Apologies for those errors.

Paul Lalli

.



Relevant Pages

  • Re: nevermind
    ... Paul Lalli wrote: ... It isn't a special character for regexes that I've ever seen used. ... This modifier allows you to use both whitespace and ... P.S. (Yes, I know PBP recommends always using /mxs, but anyone who ...
    (perl.beginners)
  • Re: Uploading 2 files with 1 CGI buffer
    ... My apologies. ... Paul Lalli ... Prev by Date: ...
    (comp.lang.perl.misc)
  • Re: Anyone got a good one-liner?
    ... My mistake. ... Apologies to Brad for that one. ... Paul Lalli ...
    (comp.lang.perl.misc)