[EMAIL PROTECTED] writes:
> I am changing a system developed by other company.
> 
> This system uses Jakarta Regexp to validate a e-mail. Now I need to change
> this to alow a e-mail address like this [EMAIL PROTECTED]
> 
> Actual Regexp : "^\w+(\.\w+)*(\_\w+)[EMAIL 
> PROTECTED](\_\w+)*(\.\w+)+(\_\w+)*$"
> 
> I am trying this but not works:
> "^\w+(\.\w+)*(\-+)*(\_\w+)[EMAIL PROTECTED](\_\w+)*(\-+)*(\.\w+)+(\_\w+)*$"
> 
> Could you help me ??

See http://jakarta.apache.org/regexp/apidocs/

_ (underscore) is not a metacharacter and doesn't need to be escaped
with \ (backslash).  And \w matches underscore as well as letters and
digits.  So the original regexp should probably be:

        ^\w+(\.\w+)[EMAIL PROTECTED](\.\w+)*$

You want to allow - (hyphen) as well as underscore and alphanumeric
characters within words, so just change \w to (\w|-):

        ^(\w|-)+(\.(\w|-)+)*@(\w|-)+(\.(\w|-)+)*$

-- 
Kevin Rodgers


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to