Fix matching of $ when there are trailing newlines #1201
Merged
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.
Closes #495
This updates the Joni and JDK RegularExpression to treat the
$
anchor in the same way as ECMAScript.This needed to update the pattern itself, namely replacing the
$
anchor for\z
The underlying issue being that the semantic meaning of$
for Joni and JDK is different from ECMAScript in that it allows trailing newlines. The meaning of\z
is closer to what$
means for ECMAScript.It's not possible for Joni to support this without changes to their code, this is actually determined in their Lexer. What is needed is
AnchorType.END_BUF
but for$
whether it's singleline or multiline only toggles betweenAnchorType.SEMI_END_BUF
andAnchorType.END_LINE
.This also updates JDK RegularExpression to be able to accept the long form Unicode Character properties that ECMAScript also accepts.