At 11:30 AM +1000 26/3/02, Cameron Just wrote:
>I was not sure as to whether regexp could do recursive matching and now I
>know.
This is crazy! There used to be clue on this list!
<?php
$test = "wed-thurs 9:35, 14:56, 18:35, 6, :12";
$patt = "/([a-z]+|[0-9]*:*[0-9]+)[ ,-]*/";
if (preg_match_all ($patt, $test, $tok)) {
while (list($k, $v) = each($tok[1])) {
echo "\$tok[$k] = $v<br>\n";
}
}
?>
Output:
$tok[0] = wed
$tok[1] = thurs
$tok[2] = 9:35
$tok[3] = 14:56
$tok[4] = 18:35
$tok[5] = 6
$tok[6] = :12
...R.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php