Constructs of the standard regular expression and meta characters

Let's get familiar with core constructs of regular expressions and some reserve meta characters that have a special meaning in regular expressions. We shall cover these constructs in detail in the coming chapters:

Symbol Meaning Example
. (dot or period) Matches any character other than newline. Matches #, @, A, f, 5, or .
* (asterisk) * matches zero or more occurrences of the preceding character or group. m* matches 0 or more occurrences of the letter m.
+ (plus) + matches one or more occurrences of the preceding element. m+ matches one or more occurrences of the letter m.
? (question mark) ? means optional match. It is used to match zero or one occurrence of the ...

Get Java 9 Regular Expressions now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.