Welcome to the LimeSurvey Community Forum

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

Email validation without spaces

  • jorgesinval
  • jorgesinval's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #201451 by jorgesinval
Email validation without spaces was created by jorgesinval
Hello!

I am using this email validation expression: /^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3})$/

Although, I had one of the participants inserting an email with spaces in the middle, which wasn't blocked by the validation expression. How can I update the above expression to avoid spaces in the middle of the email address?

Thank you.

Sinval
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 10 months ago #201453 by tammo
Replied by tammo on topic Email validation without spaces
Let me Google that for you. Found it:
emailregex.com/

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 10 months ago #201454 by tammo
Replied by tammo on topic Email validation without spaces
In other words: there is no 100% valid regex for this.

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The following user(s) said Thank You: DenisChenu
The topic has been locked.
  • jorgesinval
  • jorgesinval's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #201463 by jorgesinval
Replied by jorgesinval on topic Email validation without spaces
Which of them should I use in the validation field of LimeSurvey? Which do you suggest?

Sinval
The topic has been locked.
  • tammo
  • tammo's Avatar
  • Offline
  • Official LimeSurvey Partner
  • Official LimeSurvey Partner
More
3 years 10 months ago #201464 by tammo
Replied by tammo on topic Email validation without spaces
I have no recommendation, I never use this. If you need it, I would try.

Tammo


Tammo ter Hark at Respondage
For Limesurvey reporting, education and customized themes
respondage.nl
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago - 3 years 10 months ago #201478 by DenisChenu
Replied by DenisChenu on topic Email validation without spaces
w{2,3} : totally false (you have .social, .info etc …)

Else : to have a browser only way : gitlab.com/SondagesPro/QuestionTheme/EmailInput
(you can do same with js workaround).

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 3 years 10 months ago by DenisChenu.
The topic has been locked.
  • jorgesinval
  • jorgesinval's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 10 months ago #201547 by jorgesinval
Replied by jorgesinval on topic Email validation without spaces
Sorry, I did not get it. Which would you use? This one?

/^(\w[-._+\w]*\w@\w[-._\w]*\w\.\w{2,3,4})$/

Sinval
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 10 months ago - 3 years 10 months ago #201567 by DenisChenu
Replied by DenisChenu on topic Email validation without spaces
Why not
regexMatch('/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/',this.NAOK)

in manual.limesurvey.org/Question_type_-_Sh...8em_validation_sq.29

But start by remove the last part on {2,3,4} …

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand , plugin development .
I don't answer to private message.
Last edit: 3 years 10 months ago by DenisChenu.
The topic has been locked.
  • jorgesinval
  • jorgesinval's Avatar Topic Author
  • Offline
  • Junior Member
  • Junior Member
More
3 years 8 months ago #203804 by jorgesinval
Replied by jorgesinval on topic Email validation without spaces
It is not working as expected. I inserted the code here:




Am I missing something?

Sinval
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose