in reply to Help required on understanding regular expressions
A regex pattern that worked in 5.8 will also work in 5.10. What did you have in 5.8?
'^(\S+)\s+(\S+)\s+(\S+)\s+\[([^\]]*)\]\s+\1\z'
Well, that will continue to work in 5.10. If you wanted to use named captures,
'^(?<fname>\S+)\s+(?<mname>\S+)\s+(?<lname>\S+)\s+\[(?<date>[^\]]*)\]\ +s+\k<fname>\z'
PS — Make sure to test your code with the following string:
"Test Tester Testing [Feb 18: 28_10_10] Tests"
It shouldn't match ("Test" ne "Tests"), but it's easy to match it if the pattern isn't properly anchored.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Help required on understanding regular expressions
by shekarkcb (Beadle) on Feb 20, 2012 at 10:42 UTC | |
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 | |
by Anonymous Monk on Feb 20, 2012 at 10:50 UTC | |
by Anonymous Monk on Feb 20, 2012 at 10:54 UTC |