A regular expression is a structured
string that is used to match other strings. You can use regular expressions
for data invalidation.
Regular expression | Description |
---|---|
. | Finds any one character. |
.* | Finds any one character zero or more times. |
A.* | Finds all strings that start with "A". |
.*A | Finds all strings that end with "A". |
A? | Finds "A", zero or one time. |
A* | Finds "A", zero or many times. |
A+ | Finds "A", one time or many times. |
A?B*C+ | Finds any one character, followed by zero or one A, followed by zero or many Bs, followed by one or many Cs |
[ABC].* | Finds strings that start with the letters "A", or "B", or "C". |
.*ABC.* | Finds strings with the string "ABC" somewhere in the string. |
(ABC|DEF).* | Finds strings that start with the string "ABC" or "DEF". |