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

Use a negated character class instead of the greedy and slow .* or .+

Wherever possible, use negated character classes instead of the potential performance draining patterns (.* or .+), as follows:

param1=[^&]+&param2=[^&]+&param3=[^&]+$ 

Avoid using slow-performing quantifiers, as follows:

param1=.+&param2=.+param3=.+$ 

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