Positive lookahead

A positive lookahead assertion asserts true if the pattern inside the lookahead is matched.

The following is its syntax:

(?=...) 

For example, \d+(?=##) asserts that there must be a string, ##, immediately after matching one or more digits.

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

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.