Re: [PHP] regular expression question
- From: per@xxxxxxxxxxxx (Per Jessen)
- Date: Fri, 31 Aug 2007 20:54:26 +0200
Matthew Lasar wrote:
At 11:32 AM 8/31/2007, Per Jessen wrote:
Matthew Lasar wrote:
But I don't understand why the second half of the regular
expression works. I'm talking about this part:
@([-a-z0-9]+\.)+[a-z]{2,}/";
why is it able to detect repeated sections of the email address
after "@" that are separated by periods? like "@email.alaska.com" ..
It looks to me like it's only looking for one example of that
pattern. Does the "()" allow an unlimited number of patterns to
pass?
No, but the following '+' does.
But how? The +[a-z]{2,} seems to allow at least
two a-z clusters, but it doesn't include a period. /ml
That plus applies to the grouping () before it:
([-a-z0-9]+\.)+ one or more sequences of -a-z0-9 followed by a period
/Per Jessen, Zürich
.
- References:
- regular expression question
- From: Matthew Lasar
- Re: [PHP] regular expression question
- From: Per Jessen
- Re: [PHP] regular expression question
- From: Matthew Lasar
- regular expression question
- Prev by Date: PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem
- Next by Date: Is a small memory footprint better for a php script?
- Previous by thread: Re: [PHP] regular expression question
- Next by thread: PHP + PDO + MySQL + Stored Procedure + PREPARE = Problem
- Index(es):