People who can make regexps, you flew to us from space! :)
It seems to me that you need to have a specific mindset in order to formalize and implement regexp validators.
So, my task is to create a validator of the following sequences:
- HJ-1648
- KM-6617
- UY-7789
Conditions of the problem:
- The prefix of the article should begin only with the given pairs of capital letters. That is, nothing but HJ, KM and UY can be.
- Behind the letter sequence there should be a minus as a separator.
- Next comes a four-digit numeric sequence that cannot start from scratch.
- The length of the resulting string is strictly seven characters.
The preliminary search for a solution was not crowned. Not from the fact that lazy or careless, but from the fact that it is necessary to fly to another galaxy to understand IT :) I spent an hour and a half learning mans in English-speaking and Russian-speaking resources, but only mastered ^[AZ]$ .
if not TRegEx.IsMatch(s, '^(HJ|KM|UY)-[1-9][0-9]{3}$') thencodeif not TRegEx.IsMatch(s, '^(HJ|KM|UY)-[1-9][0-9]{3}$') then? - Interface Unknown