FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » What this means "(\w|-)+@\w"?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: What this means "(\w|-)+@\w"? [message #174785 is a reply to message #174784] Thu, 07 July 2011 15:39 Go to previous messageGo to previous message
Michael Fesser is currently offline  Michael Fesser
Messages: 215
Registered: September 2010
Karma:
Senior Member
.oO(zhang yun)

> I have some problems in regular expression, here is code :
> […]
>
> I don't know the exactly meaning of "(\w|-)+@\w", could you help me
> figure out its meaning? I'm new to posix standard.

(\w|-) any word char (see manual for details [1]) or a minus sign
+ any number of the above, but at least one
@ a literal
\w a single word char

So this matches at least one, but up to any number of word chars and
minus signs, followed by a literal '@', followed by a single word char.

An alternative way of writing (\w|-) would be [\w-], which replaces the
OR-operator by a character class, that includes word chars and the minus
sign.

HTH
Micha

[1] http://www.php.net/manual/en/regexp.reference.escape.php
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: upgrade of php & split deprecated = HELP
Next Topic: Re: What is Islam?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 21:30:28 GMT 2024

Total time taken to generate the page: 0.04562 seconds