Reply to Re: Combining 2 preg matches.

Your name:

Reply:


Posted by Chung Leong on 07/17/06 17:18

Rik wrote:
> Yes and no. It does exactly what you say, but it is simply not valid:
>
> With the pattern:
> '/^(?:[a-z0-9]|[a-z0-9][_\-][a-z0-9])+$/';
> one states the entire string can be build by either [a-z0-9](1)OR
> [a-z0-9][_\-][a-z0-9](2), think of them as blocks.
>
> Let's examine it (not entirely how it works, but this instance close
> enough):
> (fixed width font is handy now:)
> positions: 123456789012345678901234567890
> string: really_a_made_up_string
> match1: 111111_error, let's try the other option.
> match2: 111112--_error, no other matches possible.
>
> There is no possibility for a match with either (1) or (2) at the second _,
> and no other options to match instead at the beginning of the string.

Ah! I missed the single letter case.

[Back to original 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация