A regular expression is a pattern that describes a set of strings. A regular expression is a sequence of any of the following items:
- literal character
- matching character
- repetition clause
- alternation clause
- subpattern grouped with parenthesis
Regular expressions syntax
The following table lists the regular expression syntax with its corresponding descriptions:
Matches any character; used as a wildcard when creating a search string.
Matches zero or more instances of the previous pattern item.
Matches one or more instances of the previous pattern item.
Matches zero or one instance of the previous pattern item.
Groupssubpattern; repetition and alternation operators apply to the entire preceding subpattern.
Allows for an alternation of a pattern.
For example, to match Hello or hello in a string, the regular expression should read: Hello|hello.
Delimits a set of characters; the range is specified as [x-y].
If the first character in the set is ^, there is a match only when the remaining characters in the set are not present.
Anchors the pattern to the beginning of the string; this character must be the first character in the set.
Anchors the pattern to the end of the string; this character must be the last character in the set.
Provides regular expression syntax with its corresponding descriptions.