Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Always treat \r and \n as newlines #60

Merged
merged 3 commits into from
Mar 27, 2018
Merged

Always treat \r and \n as newlines #60

merged 3 commits into from
Mar 27, 2018

Conversation

smashwilson
Copy link
Contributor

By configuring pcre to recognize any unicode newline sequence, we can prevent . from matching \r on files with \r\n newlines. This makes superstring's regex matching more consistent with JavaScript's and avoids problems like atom/atom#17023, where a scanInRange() callback is triggered with a null match.

@smashwilson smashwilson merged commit e367184 into master Mar 27, 2018
@smashwilson smashwilson deleted the aw/newlines branch March 27, 2018 21:02
@smashwilson
Copy link
Contributor Author

@maxbrunsfeld I just noticed that you'd done this (better) before in dc40bb9, but reverted it in 8ff2830 with a note that #define NEWLINE_DEFAULT 2 matched JavaScript better. Do you remember in what context it did? Was it in the way ^ and $ were handled, or multiline mode?

I know that . does not match \r in JavaScript:

> /./.exec('\r')
null

But pcre did before this change.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant