Multiple Short Text validation on one field / Regex help needed

More
3 years 3 months ago #112170 by dleger
dleger created the topic: Multiple Short Text validation on one field / Regex help needed
So I'm trying to validate only 1 field in a multiple short text question.

I am using v 1.95

I found this page with a decription of what is required...

manual.limesurvey.org/Question_type_-Arr...28em_validation_q.29

I tried to adapt the example in the screenshot, but I seem to be running into issues.

A: Where would I put the vaildation equation... in the question validation equation or the sub-question validation equation ?

B: This is the equation I wrote... Does anyone see what I did wrong? Where cust1_7pc is the question code.

Question validation equation
(regexmatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_7pc))

Question validation tip
if (regexmatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_7pc)),",'postal code format< br/>')

Please Log in to join the conversation.

More
3 years 3 months ago #112191 by dleger
dleger replied the topic: Multiple Short Text validation on one field / Regex help needed - Solved
after multiple trial and errors, I managed to fix it... There were syntax errors in the original sample code.

A: It was in the question validation equation / tip it should be placed


B: here is the syntax
Question validation equation
regexMatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_custSQ7)


Question validation tip
{if(regexMatch('/^[a-zA-Z]\d{1}[a-zA-Z](\-| |)\d{1}[a-zA-Z]\d{1}$/',cust1_custSQ7)," ","Please enter a valid postal code. Format is A1A 1A1")}

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!