O'Reilly logo

Java 9 Regular Expressions by Anubhava Srivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Basic quantifiers

The following table lists all the quantifiers available in Java regular expressions:

Quantifier Meaning
m* Match m zero or more times
m+ Match m one or more times
m? Match m one or zero times (also called an optional match)
m{X} Match m exactly X times
m{X,} Match m X or more times
m{X,Y} Match m at least X and at most Y times
In all the aforementioned cases, m can be a single character or a group of characters. We will discuss grouping in more detail later.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required