Form field validation using regex

JamesJames Charlottesville, VACommunity Member Qubie ✭

Form field validation using regex

In a text entry questions with text type “Form” and 3 fields, I want to use a custom regex to allow each field to be either blank/numeric or a numeric with a trailing “%”. I am using this regex:
\s*|^\d{1,9}(.\d{1,2})?%?$
which I tested and does what I want.

In the form edit mode, there is no "match regex" so for each of the 3 fields I have to use “No Validation” because the percent sign would fail if it were “Numerical Value” and I want numbers, so “Text Value (Non-numeric)” is inappropriate as well. (‘Numerical Value’ also would not permit the percent sign.)

So I m stuck setting the entire question "Validation Type" to Custom Validation. Then my logic looks like this:
Pass if...
Q3 (option 1) 'matches regex' [as above]
AND Q3 (option 2) 'matches regex' [as above]
AND Q3 (option 3) 'matches regex' [as above]

After doing this no validation occurs because, I assume, each field is set to "No Validation".

So, is this Catch-22 or am I missing something?

Tagged:
Sign In to Comment