in reply to Regular Exp parsing
The easiest way to parse string such as this is:
my($wday, $mon, $mday, $time, $year) = $var =~ /\A(\S+)\s+(\S+)\s+(\S+)\s+(\d+):/;
Broken down -- it scans var for a regexp that matches a specific pattern, returning parameters (the things in '()') as a list.
If this is done in a loop, tag 'or next' on the end to make it skip matches that do not apply.
NOTE: Updated in response to Cupojava's observation.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Regular Exp parsing
by Zapawork (Scribe) on Dec 13, 2002 at 18:58 UTC | |
by MarkM (Curate) on Dec 13, 2002 at 21:25 UTC | |
by Zapawork (Scribe) on Dec 13, 2002 at 21:44 UTC | |
by MarkM (Curate) on Dec 13, 2002 at 21:49 UTC | |
|
Re: Re: Regular Exp parsing
by Cupojava (Novice) on Dec 13, 2002 at 21:05 UTC |