I need a regex expression for a string with the format XWS (34) 12345678 It should start with XW, followed by any letter, then a space and then two numbers within the parentheses, followed by another space and then followed by 8 letters
Asked
Active
Viewed 16 times
-2
-
1Does this answer your question? [Reference - What does this regex mean?](https://stackoverflow.com/questions/22937618/reference-what-does-this-regex-mean) – Poul Bak Apr 15 '20 at 15:49
-
the last 8 digits can be alphanumeric or only numbers, as you have stated letters but the example shows numbers – Tshiteej Apr 15 '20 at 16:14
1 Answers
1
Considering that the last 8 characters can be alphanumeric, here is the answer:
^XW[A-Z]+[ ]{1}\([0-9]{2}\)[ ]{1}[A-Z0-9]{8}$
Considering that the last 8 characters are numeric-only:
^XW[A-Z]+[ ]{1}\([0-9]{2}\)[ ]{1}[0-9]{8}$

Tshiteej
- 121
- 6