Hi, I need help, I’m having difficult to set a Reg Ex Pattern in a formated text field.
The string have to be this way:
numbers(one digit to 3 digits variable) + one letter (A-I)
Example:
10A
123B
33F
1A
Additional, if is posible I have to accept blank string too.
In case you really want to get into regular expressions, I’ve always found it easiest to read them as nondeterministic finite automata.
That is, you read the string you want to check, character by character. For each character, you check if you can pass into a new state in the regex (go to a new regex part). Or perhaps you stay in the same part, or perhaps there are no options left and the string is refused.
After that, it’s just learning the syntax.
abc a regular string just recogises that
[abc] square brackets mean a set of possible characters
a* a star means it can be repeated 0 or more times
a+ a plus means it can be repeated 1 or more times
a? a question mark means it can be present 0 or 1 time
a{1,2} curly braces mean it can be repeated between min and max times
(abc)* round parenthesis group characters together
. a dot means any character
^ the caret is the start of the string (or of the line, depending on the regex implementation)
$ the dollar sign is the end of the string (or of the line)
\. any special characters you want to use in a literal way need a backslash