[pmwiki-users] 2 fox questions

sti at pooq.com sti at pooq.com
Thu Sep 20 13:10:08 CDT 2007


Hans wrote:
> Wednesday, September 19, 2007, 6:38:38 PM, Jon Haupt wrote:
> 
>>> Again, a special filter function could be created which would handle
>>> the email varification of the email field and handles the posting
>>> accordingly. It could be built with a comparison of the email field
>>> value with a regex pattern for email addresses.
> 
>> I'll have to play with the verification idea and see what I can come
>> up with, thanks.  Luckily, for my purposes, I only need two cases: 1)
>> nothing is entered or 2) anything (e-mail or not) is entered.
> 
> Here is a fox filter function for verifying that  a correct email
> address is entered in a field "email". The preg_match line below may
> be broken by the email processing, so pleae check it
> (correct: "/^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}$/i")

Actually, that is a woefully inadequate regex for handling all possible email
addresses. There are a LOT of strange cases allowed. Here's a link to the
canonical perl regex, but I should point out that this assumes that internal
comments (yes, email addresses may contain comments) have been stripped, or
else it would be much worse:

  http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html





More information about the pmwiki-users mailing list