Welcome to the LimeSurvey Community Forum

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

Regex validation

  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 5 months ago #208213 by brais24
Regex validation was created by brais24
Hi people, Im trying to validate on multiple numerical input just one field to be able to insert just numbers between -10 and 50 with regex, but Im not be able to do it, can someone help me? I attach the lss survey file.

I try to do it with ecuation validation question but dont works fine.

Thanks for the help.


File Attachment:

File Name: limesurvey... (1).lss
File Size:22 KB
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 5 months ago #208214 by brais24
Replied by brais24 on topic Regex validation
Well, finally I be able to do something like that putting this on ecuation validation question "(is_empty(P1_SQ001) or regexMatch('/^(?:-[0-1]*[0-9]|^[0-5][0-9]*|^[0-9])$/',P1_SQ001))" and this on tip for equation validation question "{if((is_empty(P1_SQ001) or regexMatch('/^(?:-[0-1]*[0-9]|^[0-5][0-9]*|^[0-9])$/', P1_SQ001)), '', '<span style="color:red">Por favor, introduzca un valor entre -10 y 50.</span><br />')}"
The topic has been locked.
  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 5 months ago #208217 by Joffm
Replied by Joffm on topic Regex validation
Hi, brais,
why so complicated and not use this?
is_empty(P1_SQ001) or (P1_SQ001 ge -10 AND P1_SQ001 le 50)








Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless
The following user(s) said Thank You: DenisChenu, tpartner
The topic has been locked.
  • brais24
  • brais24's Avatar Topic Author
  • Offline
  • Elite Member
  • Elite Member
More
3 years 5 months ago #208300 by brais24
Replied by brais24 on topic Regex validation
Hi, because I dont know it can be done like that.
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose