- Posts: 164
- Thank you received: 5
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Regex validation
- brais24
- Topic Author
- Offline
- Elite Member
Less
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.
I try to do it with ecuation validation question but dont works fine.
Thanks for the help.
The topic has been locked.
- brais24
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 164
- Thank you received: 5
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
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 12940
- Thank you received: 3979
3 years 5 months ago #208217
by Joffm
Volunteers are not paid.
Not because they are worthless, but because they are priceless
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
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
- Topic Author
- Offline
- Elite Member
Less
More
- Posts: 164
- Thank you received: 5
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.