Regex Test Letter uppercase | XM Community
Solved

Regex Test Letter uppercase


I am using Regex to validate a question that needs 2 uppercase letters. I have used [A-Z][A-Z] and [A-Z]{2}. I have also tried \\u. When testing the question it is still allowing lowercase. What am I doing wrong?
Thanks
icon

Best answer by TomG 5 July 2018, 23:57

View original

4 replies

Userlevel 7
Badge +27
Qualtrics validation regex is case insensitive and ignores shorthand character classes. As an alternative, you could use a JavaScript event handler to convert input to uppercase.
Thank you for the idea and sorry for my ignorance I'm on the newer side with my coding skills can you point me to an example of how this is done?
Thanks
Userlevel 7
Badge +27
Assuming you will still use regex validation and just need to convert to uppercase, add the following to the addOnload function. Change the [ to a { (changed to avoid Community 'Access Denied' error):
```
jQuery("#"+this.questionId+" .InputText").on('input', function () [this.value = this.value.toUpperCase();});
```
That worked like a charm thank you very much.

Leave a Reply