Check out the LimeSurvey source code on GitHub!

regex validation problem

More
5 years 9 months ago #60022 by lovepade
Hi guys

This
^[1-9].[0-9]|[1][0-1].[0-9]|[1][2].[0]
should allow everything from allow numbers from 1.0 to 12.0

as per pythex.appspot.com/ it works.

But limesurvey (latest stable) keeps telling me that e.g. 5.8 is not correct?

I have sat max chars to 4

Any idesd

Please Log in to join the conversation.

More
5 years 9 months ago #60023 by holch
Is it just 5.8? What happens if you try it with other figures?

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

More
5 years 9 months ago #60048 by tpartner
Try:
/^[1-9]\.[0-9]$|^[1][0-1]\.[0-9]$|^[1][2]\.[0]$/

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 years 9 months ago #60067 by lovepade
Hi tpartner - thanks a lot that works.

Lesson: Always remember to escape - and don't trust pythex completely :-D

Please Log in to join the conversation.

More
5 years 9 months ago #60073 by tpartner

Always remember to escape

Yup, and also to define the beginning and end of the string with the ^ and $ characters.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form