You are here: Re: Regular Expressions « All PHP « IT news, forums, messages
Re: Regular Expressions

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]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация