Welcome to the LimeSurvey Community Forum

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

RegEx validate 01-09

More
10 years 11 months ago - 10 years 11 months ago #94295 by Xtale
RegEx validate 01-09 was created by Xtale
Hello,

I want to match numeric ranges from 01-09 and 10-31. While the code works for 10-31, I can't validate scores from 01-09 using the following code:

(!is_empty(Code_SQ007)),
regexMatch('/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/', Code_SQ007)


I do not understand the problem and would appreciate any suggestions
Best
x
Last edit: 10 years 11 months ago by Xtale. Reason: typo
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
10 years 11 months ago #94317 by DenisChenu
Replied by DenisChenu on topic RegEx validate 01-09
Hello,

Maybe something like that:

Code:
(!is_empty(Code_SQ007) or regexMatch('/^(0[1-9]|1[0-9]|2[0-9]|3[0-1])$/', Code_SQ007) )

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 topic has been locked.
More
10 years 11 months ago #94352 by Xtale
Replied by Xtale on topic RegEx validate 01-09
Thank you! However, it does not work.

Even if I put it simple
Code:
regexMatch('/^(0[1-9])$/', Code_SQ007)

it seems that 0 as the first digit is generally ignored. Maybe bugged with limesurvey?
The topic has been locked.
More
10 years 11 months ago #94353 by Xtale
Replied by Xtale on topic RegEx validate 01-09
ok,seems like its a bug with my ls version 1.92 - it works with 2.00
The topic has been locked.

Lime-years ahead

Online-surveys for every purse and purpose