in reply to Re^6: How to split unique patterns
in thread How to split unique patterns
I'll comment on the regular expression:
# 1 2 3 + 4 5 6 $line=~ /^(\w+)::(gmdate):(20\d\d-[01]\d-[0123]\d [012]\d:[0-6]\ +d):(\w+):(\w*):(.*)/
The stuff parentheses fill in $1 to $6. This is commonly called "capturing parentheses", and documented in perlre.
The first pair of parentheses captures a sequence of characters (\w+), like info.
The second pair captures the literal string gmdate. We could have left the capture out, but maybe we want to expand the RE later to allow for other strings in that place.
The third pair captures something that looks like a YYYY-mm-dd HH:MM timestamp, with some basic validation thrown in:
If you can tell us where exactly you have problems with the regular expression, that will help us help you better.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^8: How to split unique patterns
by cornelius80 (Initiate) on Jun 11, 2013 at 02:29 UTC | |
by Corion (Patriarch) on Jun 11, 2013 at 07:51 UTC |