Re: Combining 2 preg matches.
- From: "Chung Leong" <chernyshevsky@xxxxxxxxxxx>
- Date: 17 Jul 2006 10:18:08 -0700
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.
.
- References:
- Combining 2 preg matches.
- From: frizzle
- Re: Combining 2 preg matches.
- From: Chung Leong
- Re: Combining 2 preg matches.
- From: frizzle
- Re: Combining 2 preg matches.
- From: Rik
- Re: Combining 2 preg matches.
- From: Chung Leong
- Re: Combining 2 preg matches.
- From: frizzle
- Re: Combining 2 preg matches.
- From: Rik
- Re: Combining 2 preg matches.
- From: Chung Leong
- Re: Combining 2 preg matches.
- From: Rik
- Combining 2 preg matches.
- Prev by Date: Re: Combining 2 preg matches.
- Next by Date: Login / Password
- Previous by thread: Re: Combining 2 preg matches.
- Next by thread: Is URL for a bif file valid?
- Index(es):
Relevant Pages
|