-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regex bug with line endings handling #162
Comments
Looks like the issue is that in .NET the new Regex("^.*$", RegexOptions.Multiline).Matches("one\r\ntwo\r\n")[0].Value
// returns "one\r" Whereas in javascript it matches 'one\r\ntwo\r\n'.match(/^.*$/m)[0]
// returns "one" |
The workaround is to change your regular expression: var rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg; |
Unfortunately I cannot use a workaround because this code is from jquery. And there are probably tons of code on web pages that use regular expressions. Please look at the similar issue in jint |
@RusKnyaz For implementation of regular expressions in the Jurassic, Jint and NiL.JS engines are used a |
@Taritsyn I kown it. And It is possible to fix. Please look the link I provided in previous comment. |
I've checked in a fix, let me know if it works for you :-) |
@RusKnyaz You'll notice that my fix is more complicated than the Jint one. It seems the fix in Jint is not correct. |
It seems the fix in Jurassic is also not 100% correct 😉 |
Ha, you're right, darn it. |
I checked in a fix for the escaping issue. |
Execute the code:
Expected:
arr is array of ["x-aspnetmvc-version", "4.0", "x-powered-by", "ASP.NET"]
Observed:
arr is empty.
The text was updated successfully, but these errors were encountered: