Restricting field to upper case

Hi everyone

I want to restrict my field to 8 characters and upper case only. The length is working perfectly fine and the error message is working just as fine too. What rule can I use for upper case please?

d2:hasValue(A{IM}) && d2:length(A{IM}) != 8 && d2:validatePattern( A{IM}, [] )

Above, I somehow believe I have to use validate pattern but I am not sure what to enter in the [], thereby I left it empty for your opinions.

Thank you

Hi @Peck_Secia

Yo don’t need to count the expression with length as you could directly validate with the d2:validatePattern function for both counting and upper letters. This is a working example:

Incorrect inputs:

Correct input:


Hi Jaime, thank you.

This worked for me: d2:hasValue(A{IM}) && !d2:validatePattern(A{IM},‘^[A-Z]+$’)

1 Like

Good, but please note that your regular expression at the moment is not limiting at all in size. As long as you have something starting and ending with capital letters and longer that one should be validated. That is:

  • AB
  • Z
1 Like

@jaime.bosque right! I had suggested that in a different post when d2:length(A{IM}) was included in the expression but then corrected my post:

Thanks! (:

1 Like