Select to view content in your preferred language

Regex to Differentiate Individual Letter

564
2
Jump to solution
08-25-2023 12:14 PM
IsaacRowland
New Contributor

I am trying to change the conditional visibility of a field based on the answer to another. It is a multiple select questions with domain options of (IP, PH, DH, M, EM, and VM). I want to show Questions02 when IP or DH or M are selected from Question01. I am currently using   regex(${Question01}, '(IP|DH|M)')   but this will also be true if you select EM or VM in Question01. How do I keep it true if M is selected but not EM or VM?

0 Kudos
1 Solution

Accepted Solutions
abureaux
MVP Frequent Contributor

You don't need regex here. This will do what you are wanting:

selected(${Question01},'IP') or selected(${Question01},'DH') or selected(${Question01},'M')

 

View solution in original post

2 Replies
jcarlson
MVP Esteemed Contributor

Check out https://regex101.com, it is an excellent resource for learning about and testing out regex statements.

Since you want to match the full text, not partial, you can include "^" and "$" for start and end of the string, respectively. You can see here that EM and VM are not included in the matches.

jcarlson_0-1692995026054.png

 

- Josh Carlson
Kendall County GIS
0 Kudos
abureaux
MVP Frequent Contributor

You don't need regex here. This will do what you are wanting:

selected(${Question01},'IP') or selected(${Question01},'DH') or selected(${Question01},'M')