Regular Expression Challenge
| From: | Cameron Just | Date: | Mon, 25 Mar 2002 06:15:47 +0000 |
| Subject: | Regular Expression Challenge | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89985@lists.php.net to get a copy of this message | ||
Hi,
I am trying to pull out the following information via a regular expression.
The string I am searching on is 'wed-thurs 9:35, 14:56, 18:35'
and I want it to retreive
wed
thurs
9:35
14:56
18:35
The regular expression I am using is
([a-z]+)-([a-z]+) +([0-9]{1,2}:?[0-9]{0,2})[, ]*
It seems to be grabbing the
wed
thurs
9:35
but I can't seem to retrieve the rest of the times.
Anyone have any ideas?
BTW
There can be any number of 'times' in the string and also the 'times' can
be with or without the colon and the minutes, hence the '}:?[0-9]{0,2}'
part of the regexp.