How to Use Extended Regular Expression Metacharacters
Regular expressions are used for pattern matching in text. Usage of a regular expression tool or engine can range from searching text to replacing strings of characters within the text. Regular expressions are a string or single character which define how the matching is defined. They can be made up of characters, as well as metacharacters, which are reserved for unique matching purposes. Basic regular expressions are included in all regular expression tools/engines but extended regular expression metacharacters may not be available by default. Depending on the tool they may need to be enabled.
An extended-regular expression capable engine, made available by some tool or language. The Linux command line utility grep, for instance, has regular expression abilities, and the language Perl has capabilities for regular expression matching built in.
The extended regular expression metacharacters are:
? + |
? matches the preceding character, metacharacter, or expression zero or one time.
+ matches the preceding character, metacharacter, or expression one or more times. There is no limit to the amount of times it can be matched.
| matches the character, metacharacter, or expression on either side of it.