Java Regex Z Assertion - #1755
Merged
Merged
Conversation
lmasroca
marked this pull request as ready for review
September 13, 2026 22:03
jgaleotti
approved these changes
Sep 15, 2026
arcuri82
approved these changes
Sep 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for Java regex
\Zassertion and linebreak matcher\R:\Zis an end of input assertion that allows a final line terminator. This assertion matches at the end of the input or just before a line terminator with no characters following after it. This assertion's allowed terminators change depending on flagd,UNIX_LINES. For example^(?s)\Z.*matches with "",\n, etc. Unlike\zwhich just forces all following genes to zero-width,\Zmay also try to force a line terminator onto one of the following genes and the rest to zero-width.\Rmatches any Unicode linebreak sequence, is equivalent to\r\n|[\n-\r\u0085\u2028\u2029]. Unlike the previous mention, this is not an assertion, so it produces a sequence of characters (unlike assertions). This is represented by building aDisjunctionListRxGenethat can produce the same characters as its Java Pattern counterpart. This escape's characters are not modified by flags.Note: both of these recognize some single character line terminator sequences (like
\nor\u2029) and one two-character sequence\r\n(this sequence is a single line terminator,CRLF).