Email fomatting pattern

C

Chris D

Hi can someone please show me how to verify for a correct email syntax. I
tried entering
^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}$ in the
custom pattern but that was rejected. Thanks ... Chris
 
S

S.Y.M. Wong-A-Ton

Try this one:

([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))

You need to remove the beginning ^ and ending $ from any regular expression
you try to use in InfoPath, otherwise you'll get back an error.
 
C

Chris D

Hi S.Y.M. thanks but nope it still comes up with '... one or more errors' &
referenced the square brackets. Tried replacing those with regular brackets
but it the had issue with the '\'. Any thoughts?? Thanks again ... Chris

S.Y.M. Wong-A-Ton said:
Try this one:

([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))

You need to remove the beginning ^ and ending $ from any regular expression
you try to use in InfoPath, otherwise you'll get back an error.
---
S.Y.M. Wong-A-Ton


Chris D said:
Hi can someone please show me how to verify for a correct email syntax. I
tried entering
^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}$ in the
custom pattern but that was rejected. Thanks ... Chris
 
S

S.Y.M. Wong-A-Ton

Chris, did you try the expression I supplied or are you still trying to get
your own to work? And where are you using this regular expression? In data
validation? The expression I supplied you with worked when I last tried it. I
get errors when trying yours, so there must be something wrong with it. Does
it work in other applications or code that uses regular expressions? You may
want to try another newsgroup (csharp or comp.lang.perl.misc) to help you
troubleshoot your pattern.
---
S.Y.M. Wong-A-Ton


Chris D said:
Hi S.Y.M. thanks but nope it still comes up with '... one or more errors' &
referenced the square brackets. Tried replacing those with regular brackets
but it the had issue with the '\'. Any thoughts?? Thanks again ... Chris

S.Y.M. Wong-A-Ton said:
Try this one:

([\w\-\.]+)@((\[([0-9]{1,3}\.){3}[0-9]{1,3}\])|(([\w\-]+\.)+)([a-zA-Z]{2,4}))

You need to remove the beginning ^ and ending $ from any regular expression
you try to use in InfoPath, otherwise you'll get back an error.
---
S.Y.M. Wong-A-Ton


Chris D said:
Hi can someone please show me how to verify for a correct email syntax. I
tried entering
^\+?[a-z0-9](([-+.]|[_]+)?[a-z0-9]+)*@([a-z0-9]+(\.|\-))+[a-z]{2,6}$ in the
custom pattern but that was rejected. Thanks ... Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top