In an iOS app I have a identity card field. I want to show users the format. What the most appropriate/clear to describe the following regex:


Currently I have:

Starting with 1 letter (X, Y, or Z), followed by 7 digits (0-9),
and ending with 1 letter (A, B, C, D, E, F, G, H, J, K, L, M,
N, P, Q, R, S, T, V, W, X, Y, or Z); without any other character
or space.


  • How to indicate ranges of digits/letters, is (0..9) or (0 - 9) better?
  • Should I write (A-H, J-N, P-T, or V-Z) (should I use or here actually?) instead, or perhaps (A-Z except I, O or U)?
  • Should I write 7 digits or seven digits, ...
  • ...

What's best in a situations like this?

  • Is the user creating their ID here or are they inputting an ID that they already have?
    – DasBeasto
    Jun 6, 2016 at 20:36
  • @DasBeasto They are entering an existing ID, for example of their national identity card. Interesting question, what are you thinking about? Jun 6, 2016 at 20:37

1 Answer 1


If the digit range is not restricted (0-9) you may omit this information, this strips some complication off the sentence. What about:

X, Y or Z, followed by 7 digits, followed by any letter except I, O or U.

If any other rule is violated (for example spaces or special characters have been added) you could display a more specific error message.

  • How nice! Seems I've too hard been trying to translate the regex. Jun 6, 2016 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.