Christian Reiniger wrote:
>
> 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.
That's what I get for shooting my mouth off without actually trying it out.
But I should of caught the ^$
>
> > And the | is using '\d' and 'prem'. It probably should be
> > "/(div\d)|prem/ Unless those parens are part of the expression. Then
And after a second look, yea the \d is tightly bound to the div.
But in confirming this, besides matching something like
'div2' it will also match div23 - both returning div2.
Don't know the data, so it might not make any difference.
Mike D.
--
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]