Custom validation - capital letters only | Experience Community
Skip to main content

Custom validation - capital letters only

  • Nov 29, 2022 10:36 AM UTC
  • 2 replies
  • 111 views

Forum|alt.badge.img+1

Hi

I am asking participants to fill in a code for identification. I want this to only consist of 2 capital letters. I am currently using this code in the validation: ^[A-Z]{2,2}$ I thought this would only allow capitals but it allows lowercase too. Does anyone have suggestions for changing it please? Many thanks.

2 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+48
  • Nov 29, 2022 11:11 AM UTC

Susan_Gibson
Try this: (It only allows 2 letters from A-Z in uppercase e.g. AF)
/^[A-Z]{2}$/
Hope it helps!


Forum|alt.badge.img+1