Using a RegEx to trigger an action | Experience Community
Skip to main content
Solved

Using a RegEx to trigger an action

  • Jul 9, 2018 9:08 PM UTC
  • 7 replies
  • 251 views

Hello all! I am trying to create an action which would be triggered by the presence of any of a large quantity of terms in an open ended response. Would the correct condition be the following: Question > Question Name > Question Text > Matches RegEx > /(term1)|(term2)|(term3)|.../(termn)/gi/ Does the RegEx need to be preceded by anything other than "/"? do the end flags (g/i) need to be followed by "/"? Cheers! Joachim

Best answer by mattyb513

Yeah, I'd imagine that it's using the same engine for all its regex evaluation. Are you seeing differently?
View original

7 replies

mattyb513
Level 4 ●●●●
Forum|alt.badge.img+6
  • Level 4 ●●●●
  • Jul 10, 2018 11:23 AM UTC
Yeah, your approach is correct. You would literally just drop it in like the following: ``` /(term1)|(term2)|(term3)|(termn)/gi ``` Obviously swapping out the terms for real terms. If any of them match in this case it will pass the validation. This validation would be on the question that contains the text entry box typically. Example: https://qualtricssfi.az1.qualtrics.com/jfe/preview/SV_dgr675yqpa0YWvH?Q_SurveyVersionID=current&Q_CHL=preview

bstrahin
Level 6 ●●●●●●
Forum|alt.badge.img+38
  • Level 6 ●●●●●●
  • Jul 10, 2018 12:36 PM UTC
If you happen to have trouble with the RegEx you can also use display logic for this. One line for each term with the condition. Question > Question Name > Question Text > Contains > (term 1) OR Question > Question Name > Question Text > Contains > (term 2) OR Question > Question Name > Question Text > Contains > (term 3)... You would lose the benefit of the case insensitive code from the RegEx though.

  • Author
  • Jul 10, 2018 1:05 PM UTC
Thanks @bstrahin ; my main issue is that I have 50~ terms that I want to use to trigger this action.. and that I need to reproduce this action across multiple surveys. Definitely a great albeit labor intensive plan b!

  • Author
  • Jul 10, 2018 1:06 PM UTC
> @mattyb513 said: > Yeah, your approach is correct. You would literally just drop it in like the following: > ``` > /(term1)|(term2)|(term3)|(termn)/gi > ``` > Obviously swapping out the terms for real terms. If any of them match in this case it will pass the validation. This validation would be on the question that contains the text entry box typically. > > Example: https://qualtricssfi.az1.qualtrics.com/jfe/preview/SV_dgr675yqpa0YWvH?Q_SurveyVersionID=current&Q_CHL=preview Thanks @mattyb513 ; your example shows the regex validation used for survey logic. Would the same regex be valid when using "Matches RegEx" to trigger actions (ticketing/email?). Cheers!

mattyb513
Level 4 ●●●●
Forum|alt.badge.img+6
  • Level 4 ●●●●
  • Answer
  • Jul 10, 2018 2:05 PM UTC
Yeah, I'd imagine that it's using the same engine for all its regex evaluation. Are you seeing differently?

  • Author
  • Jul 10, 2018 3:08 PM UTC
@mattyb513 Between my question and now I've managed to successfully test, can confirm that it works as you said it would!

Emily
Qualtrics Employee
Forum|alt.badge.img+7
  • Qualtrics Employee
  • Jul 25, 2018 11:32 PM UTC
> @mattyb513 said: > ^ Whoops - wrong thread but I can't delete this for some reason. Sorry! No worries! Deleted now!