- Posts: 9
- Thank you received: 0
Welcome to the LimeSurvey Community Forum
Ask the community, share ideas, and connect with other LimeSurvey users!
Regex for Grades
- ngreis
- Topic Author
- Offline
- New Member
Less
More
8 years 4 days ago #134841
by ngreis
Regex for Grades was created by ngreis
Hello
I need a valid regex for validating a input field, that goes from 0 to 20 with 3 decimal places, with comma as a decimal delimiter.
This is for people stating their grade at a certain discipline.
from 0,000 to 20,000, should be ok, negative and over 20,000 (ex 20,001+) should put the warning in the input field bold.
The regex i tried is this
^([0-9]\,[0-9][0-9])?$|(1[0-9]\,[0-9][0-9])?$|(20\,[0-9][0-9])?$
On this site, http_s://regex101.com/r/bQ5sM4/12
Seems to validate, but when placed here:
fails the warning
Thx for the help in advance
Best regards
Nuno Reis
I need a valid regex for validating a input field, that goes from 0 to 20 with 3 decimal places, with comma as a decimal delimiter.
This is for people stating their grade at a certain discipline.
from 0,000 to 20,000, should be ok, negative and over 20,000 (ex 20,001+) should put the warning in the input field bold.
The regex i tried is this
^([0-9]\,[0-9][0-9])?$|(1[0-9]\,[0-9][0-9])?$|(20\,[0-9][0-9])?$
On this site, http_s://regex101.com/r/bQ5sM4/12
Seems to validate, but when placed here:
fails the warning
Thx for the help in advance
Best regards
Nuno Reis
The topic has been locked.
- DenisChenu
- Offline
- LimeSurvey Community Team
Less
More
- Posts: 13624
- Thank you received: 2490
8 years 3 days ago #134904
by DenisChenu
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.
Replied by DenisChenu on topic Regex for Grades
With numeric question type : surely more easy to use min value and max value.
Regexp is done for string. For numerci string is updated to number when tested. Then 20,111 is updated to 20111.
Regexp is done for string. For numerci string is updated to number when tested. Then 20,111 is updated to 20111.
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.
The following user(s) said Thank You: ngreis
The topic has been locked.
- ngreis
- Topic Author
- Offline
- New Member
Less
More
- Posts: 9
- Thank you received: 0
8 years 3 days ago #134908
by ngreis
Replied by ngreis on topic Regex for Grades
Good morning
Yes, you are right, tunnel vision on my part.
Used regex for other fields before, did not even think any further.
Thx
Yes, you are right, tunnel vision on my part.
Used regex for other fields before, did not even think any further.
Thx
The topic has been locked.