Custom Validation: Match Regex = using different language characters - URGENT HELP NEEDED | Experience Community
Skip to main content

Custom Validation: Match Regex = using different language characters - URGENT HELP NEEDED

  • Sep 26, 2022 9:07 AM UTC
  • 3 replies
  • 817 views

Forum|alt.badge.img+7

Hi all,
I have a single library reference block that has been translated into several languages. As such, the feedback and answers to a practice question change depending on the language that is selected.
For example, for English, participants would type in "PT" and they would be able to progress. For German, participants would type in "ÜZ". However, I am having an issue with participants using characters from other languages, such as "Ü" in this instance. I know that this is because of the match regex I have:
^[A-Z]{2}$
Two characters between A-Z only. I also know that "\\p{L}" exists to allow any language.
Could anyone please help me to put these two together so that the question will only accept two characters from any language, similar to the above regex?
Note - I have tried:
^[\\p{L}][A-Z]{2}$
^\\p{L}[A-Z]{2}$
^{\\p{L}}[A-Z]{2}$
^\\p{L}{2}$

None of these seemed to work.
Any help would be greatly appreciated.
Thank you in advance.

3 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Sep 26, 2022 12:20 PM UTC

Try:
^[\\p{L}]{2}$


Forum|alt.badge.img+7

Thank you, TomG ! One of the ones I did not think to add in.


SuhasM
Qualtrics Employee
Forum|alt.badge.img+16
  • Qualtrics Employee
  • Oct 3, 2022 3:08 PM UTC

Regex is tricky! Thank you TomG for a super fast response, we truly appreciate it! 🙂