PowerBuilder Regular Expression Bug

Trying to fix a bug in an email validation expression that needs to be able to handle:

name.bytof@zz.some-city.ca.us

After the @, it's failing on the '-' after the first '.' -- the hyphen works fine if it's before the first '.' but anytime after the first '.' it fails.

Tried quite a few things including:

match(gettext(),'\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-+.]\w+)*')
match(gettext(),'^[a-zA-Z0-9][a-zA-Z\0-9\-_\.]*[a-zA-Z\0-9\-_]\@\w+([-.]\w+)*\.\w+([-.]\w+)*')
etc.

It's mandatory to test for a '.' existence after the '@'.

Suggestions on what would fix this would be great appreciated!
ssebringAsked:
Who is Participating?
 
EE_AutoDeleterConnect With a Mentor Commented:
ssebring,
Because you have presented a solution to your own problem which may be helpful to future searches, this question is now PAQed and your points have been refunded.

EE_AutoDeleter
0
 
ssebringAuthor Commented:
Got it to work with:

match(gettext(),'^[a-zA-Z0-9][a-zA-Z\0-9\-_\.]*[^.]\@[^.][a-zA-Z\0-9\-_\.]+\.[a-zA-Z\0-9\-_\.]*[a-zA-Z\0-9]+$')

Thanks anyways!  (this post can be closed)

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.