On 05/07/2014 01:40 AM, John SJ Anderson wrote:
my @strings = (
"^Modifications made by Danny Wong (danwong) on 2014/05/06 18:27:48
from database brms" ,
"^Modifications made by danwong on 2014/05/06 18:27:48 from database brms²",
);
foreach my $string ( @strings ) {
my( $match ) = $string =~ /by (.*?) on/;
if ( $match and $match =~ /\(([^)]+)\)/ ) {
$match = $1;
}
say "Matched '$1' in '$string'"
if $match;
}
i would go with just getting the word before an optional ), then 'on'
and the year. untested:
my $match = $string =~ /(\w+)\)?\s+on\s+\d+/ ;
uri
--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/