in reply to Re: Help required on understanding regular expressions
in thread Help required on understanding regular expressions
I am not converting anything, just wanted to learn new feature, Still not able to get it working ... below is the code.
use strict; use Data::Dumper; my %hash=(); my $str="Test Tester Testing [Feb 18: 28_10_10] Test"; #my $reg='(?<fname>\w+\b)\s(?<mname>\w+)\s(?<lname>\w+\s).*\[(?<date>[ +^\]]+)/'; my $reg='^(?<fname>\S+)\s+(?<mname>\S+)\s+(?<lname>\S+)\s+\[(?<date>[^ +\]]*)\]\+s+\k<fname>\z'; { if($str =~ /$reg/) { %hash=%+; } } print Dumper \%hash;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Help required on understanding regular expressions
by JavaFan (Canon) on Feb 20, 2012 at 12:10 UTC | |
by shekarkcb (Beadle) on Feb 20, 2012 at 15:18 UTC | |
by NetWallah (Canon) on Feb 20, 2012 at 15:32 UTC | |
|
Re^3: Help required on understanding regular expressions
by Anonymous Monk on Feb 20, 2012 at 10:50 UTC | |
|
Re^3: Help required on understanding regular expressions
by Anonymous Monk on Feb 20, 2012 at 10:54 UTC |