On Wednesday 07 February 2001 21:50, Michael Dearman wrote:
> >         }
> >         elseif( preg_match( "/^\d+$/", $arg[$i], $matches ) )
>
> Isn't this \d+ matching ----------^
>
> >         {
> >                 $value = $matches[0];
> >         }
> >         elseif( preg_match( "/(div\d|prem)/", $arg[$i], $matches ) )
>
> the \d in this-----------------^------------^

No. the 1st expression is /^\d+$/ , i.e. match strings with at least one 
decimal number and nothing else (\d+) from their beginning (^) to their 
end ($)
I.e. that one only catches strings consisting only of decimal digits.

> And the | is using '\d' and 'prem'. It probably should be
> "/(div\d)|prem/ Unless those parens are part of the expression. Then

No, that's fine.
(div\d|prem)

means "match either 'div\d' or 'prem'" and memorize that part

-- 
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)

"These are the people who proudly call themselves "hackers" --
not as the term is now abused by journalists to mean a computer
criminal, but in its true and original sense of an enthusiast,
an artist, a tinkerer, a problem solver, an expert."

- ESR

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to