Regular Expression Challenge
| From: | Matt Moreton | Date: | Mon, 25 Mar 2002 06:56:59 +0000 |
| Subject: | Regular Expression Challenge | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-89989@lists.php.net to get a copy of this message | ||
Perl Compatible Regular Expression:
"/'([a-z]+)-([a-z]+)\s([0-9]+:[0-9]+),\s([0-9]+:[0-9]+),\s([0-9]+:[0-9]+)'/"
Assuming the days of the week are always lower case? if not then use
[a-zA-Z] for the day matching.
Hope this helps.
--
Matt.
----- Original Message -----
From: "Cameron Just" <c.just@phoenixdigital.com>
To: <php-general@lists.php.net>
Sent: Monday, March 25, 2002 6:15 AM
Subject: [PHP] Regular Expression Challenge
> 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.
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>