Do embedded fields used in regular expressions need escape characters? | XM Community
Skip to main content
Question

Do embedded fields used in regular expressions need escape characters?

  • December 21, 2020
  • 1 reply
  • 89 views

I want to use a regular expression that matches an embedded field in custom validation.
The embedded field may contain characters that need to be escaped in the regex, such as a dot.
Let's say, for example, that the value of the embedded field website1 is mysite.com.
I want the regex to take it literally and not use the dot as a wildcard.
Would it work if I add ${e://Field/website1} into the expression?
Or do I need to have the embedded field value with the escape character?
Thanks for your help.

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • December 23, 2020

You would never pipe a string into a regex. You escape the characters in the regex, not in the piped string. Your condition might look something like like:
If Embedded Data website1 matches regex ^.*\\..*$