Posted by Veikko Mδkinen on 08/05/05 14:18
Stefan Rybacki wrote:
> John wrote:
>
>> I am fairly new to php but I think I must be completely missing the
>> poiny here (or going mad)
>>
>> I would have expected this to match, am I right?
>>
>> if (eregi("a89", "a.[0-9]" ))
>> {echo "<br>match";}
>> else {echo "<br>no match";}
>
>
> Read the manual. The first parameter of eregi is the search pattern and
> the second the string to match.
>
> if (eregi("a.[0-9]", "a89" ))
Note that this also matches "ab0" but not "a9".
If you want pattern " one 'a' followed by two digits" you need to use
"a\d{2}" or "a[0-9]{2}".
-veikko
--
veikko
mail@ .com
makinen
Navigation:
[Reply to this message]
|