Page 2 of 2
Re: Email matching problem
Posted: Sat May 17, 2008 2:27 am
by prometheuzz
GeertDD wrote:prometheuzz wrote:...
The problem is that now the first part of the email can start and/or end with a dot. One way to prevent this is using lookaround.
...
All very true! Note that the OP asked for a loose regex. You can make the regex more and more exact, but that is a decision for the OP.
You can also extend your regex so that there cannot occur two dots in succession, but it would make the regex more and more "voodoo-like" (not for you, but most regex-mortals)
; )
But it's good that you posted a different version of it: now the OP can decide which one to use.
Re: Email matching problem
Posted: Sat May 17, 2008 2:53 am
by GeertDD
prometheuzz wrote:2 - Since validating e-mail addresses will not be done on large strings*, the time wasted on backtracking when an invalid addresses entered will be next to nothing.
* the text field where the user enters his/her e-mail address should be restricted. No multi line and a fixed width.
It was just a suggestion. I would use possessive matching anyway because you never know and cannot restrict what POST data contains.
Re: Email matching problem
Posted: Sat May 17, 2008 3:00 am
by prometheuzz
GeertDD wrote:... because you never know and cannot restrict what POST data contains.
Also true, Geert.