j055
asked on
regEx pattern validates differently in XML schema
Hi
This Regular expression doesn't accept underscores in a XML schema but it does validate with other tools. It's actually from ASP.NET.
\w+([-+.']\w+)*@\w+([-.]\w +)*\.\w+([ -.]\w+)*
e.g. 'bill_smith@email.co.uk' fails.
It seems odd that a schema treats it differently. What do I need to do?
Thanks
Andrew
This Regular expression doesn't accept underscores in a XML schema but it does validate with other tools. It's actually from ASP.NET.
\w+([-+.']\w+)*@\w+([-.]\w
e.g. 'bill_smith@email.co.uk' fails.
It seems odd that a schema treats it differently. What do I need to do?
Thanks
Andrew
ASKER
Thanks for the clues
I changes this:
\w+([-+.']\w+)*@\w+([-.]\w +)*\.\w+([ -.]\w+)*
to this
\w+([-+.'_]\w+)*@\w+([-.]\ w+)*\.\w+( [-.]\w+)*
I just needed to allow underscores before the @ sign.
Thanks
Andrew
I changes this:
\w+([-+.']\w+)*@\w+([-.]\w
to this
\w+([-+.'_]\w+)*@\w+([-.]\
I just needed to allow underscores before the @ sign.
Thanks
Andrew
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window