Reputation: 328
I need to do some data filtering and I have a question here. How can I check if text is formatted like this:
TEXT-1/1
. TEXT - some text in capital letters, 1 - any positive integer. So, for example, "FA-5/9" will be valid but "FA-AV" will be invalid.
Thanks for answers. :)
Upvotes: 0
Views: 47
Reputation: 4044
this one will match what you want:
[A-Z]+-\d\/\d
Explained:
[A-Z]+
# will match one or more A-Z characters (link)
-
# will match dash (-)
\d\/\d
# will match digit slash digit (1/1)
Upvotes: 2