Select to view content in your preferred language

Can't figure out how to write the proper regex expression in the relevance column

237
5
07-08-2025 12:19 PM
Jonatanson_DUC
Emerging Contributor

Hey all!

I'm having trouble figuring out how to make a repeat appear or not based on the answer of two questions: a yes/no and a select_one question.

Scenario:

User choose No in Question 1.
User chooses a single value in Question 2 - which is a select_one: N/A,1, 2, 3, 4... up to 100.
These values are saved in the Choices spreadsheet.

If a users chooses N/A or 100, I need a repeat to NOT appear.
If they choose values between 1-99, the other repeat will appear.

Right now I'm using regex expressions in the Relevance column as such:
regex(${Question_1}, "n") and regex(${Question_2}, "[1-99]")

I've also tried listing all the values as below (except they keep going):
regex(${Question_1}, "n") and regex(${Question_2}, "[1,2,3,4,5...]")

Both of the above work except if I select "100", then the repeat shows up.

Any ideas are appreciated!!

Tags (3)
0 Kudos
5 Replies
Neal_t_k
Frequent Contributor

What about something like this:

selected(${Question_1},"No")  and (not(selected(${Question_2} ,"NA")) and not(selected(${Question_2} , "100")))

and on the other repeat:

selected(${Question_1},"No")  and (selected(${Question_2} , "NA") or selected(${Question_2} , "100"))

 

Jonatanson_DUC
Emerging Contributor

Hey @Neal_t_k !  Thanks for the reply.  Maybe I wasn't clear in what I'm trying to do.

Here's a better breakdown.

Question_1 options: Yes/No
Question_2 options: N/A, 1, 2, 3, 4... 100

If Question_1 = Yes then Question_3 remains hidden on the survey
If Question_1 = No and Question_2 = N/A or 100 then Question_3 remains hidden on the survey
If Question_1 = No and Question_2 =any of 1, 2, 3, 4...99 then Question_3 appears on the survey

Hopefully that makes more sense.

0 Kudos
Neal_t_k
Frequent Contributor

This should be what you want for question 3 in that case.

selected(${question_1},"no")  and (not(selected(${question_2} , "N/A")) and  not(selected(${question_2} , "100")))
0 Kudos
Jonatanson_DUC
Emerging Contributor

That's not it either.  When I enter that expression, Question_3 doesn't appear under any circumstance.  It's hidden for all Question_2 selections.

0 Kudos
Neal_t_k
Frequent Contributor

@Jonatanson_DUC here is a working example.

0 Kudos