Java - Regular Expressions Metacharacters

Introduction

Metacharacters are characters with special meanings in Regular Expressions.

The metacharacters supported by the regular expressions in Java are as follows:

MetacharactersMeaning
( a left parenthesis
) a right parenthesis
[a left bracket
] a right bracket
{ a left brace
{ a right brace
\ a backslash
^ a caret
$ a dollar sign
| a vertical bar
?a question mark
*an asterisk
+ an addition sign
.a dot or period
< a less-than sign
> a greater-than sign
- a hyphen
= an equal to sign
! an exclamation mark