in reply to Re: regex for perl script
in thread regex for perl script

I've got it working.
'^(\d\d\d\d-\d+-\d+ \d+:\d+:\d+) (?:imap|pop3)-login: Info: ' . 'Login: .*? (?:\[|rip=)[:f]*(\d+\.\d+\.\d+\.\d+)[],]';
Thanks.

Replies are listed 'Best First'.
Re^3: regex for perl script
by Khen1950fx (Canon) on May 16, 2011 at 20:25 UTC
    Just in case the regex gets crazy on you, fall back to Text::CSV::Simple.
    #!/usr/bin/perl use strict; use warnings; use Text::CSV::Simple; use Data::Dump qw(dump); my $logfile = "/root/Desktop/ip.log"; my $parser = Text::CSV::Simple->new; $parser->want_fields(2); my @data = $parser->read_file($logfile); print dump(@data);