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

Extract common repeating substrings out of alternation

Consider the following pattern:

(playground|player|playing) 

Instead of using the preceding pattern, it is better to extract the common substring, play, and move it to the left of alternation, as follows:

play(ground|er|ing) 

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