Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

email validation

  • ritapas
  • ritapas's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
2 months 2 weeks ago #267870 by ritapas
email validation was created by ritapas
Hello,
I see that in the user manual it is advised to use the following RegExp to validate email addresses:
Code:
/^.+?@.+?\..+$/

However, this would validate an email address containing whitespace.
I've found this RegExp would validate correctly an email address:
Code:
^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$

I know that the manual is a wiki and that I could correct it, however, I wonder if there is a reason for leaving that string.

Cheers,
Rita

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
2 months 2 weeks ago - 2 months 2 weeks ago #267915 by DenisChenu
Replied by DenisChenu on topic email validation

    The full regexp for RFC2822 addresses was a mere 3.7k.

Because there are no good way to check an email address via regexp ?
code.iamcal.com/php/rfc822/full_regexp.txt

Then : maybe it's better to allow bad address but accept all valid address ?

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 2 months 2 weeks ago by DenisChenu.
The following user(s) said Thank You: ritapas

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose