-
-
Notifications
You must be signed in to change notification settings - Fork 553
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
Update RegExpPrototype.cs #272
Conversation
RegExp result should be mutable array.
Looking at the specification, this line should not be removed, but replaced by this:
This will have the same effect on immutability, fix the correct value, and be compliant. As all the tests passed it would make sense to add a new Thanks |
FYI: http://www.ecma-international.org/ecma-262/5.1/#sec-15.10.6.2 |
I made this PR based on the specification. Do you have some code that triggered the issue you are seeing so that I can add it to the tests? |
Hi! Thanks for you answer and sorry for the delayed response. I haven't checked your decision yet and haven't dealt with your tests (them much, and at me they aren't stable). I plan to make it soon. I develop headless .net web browser and met two issues with jquery+regexp. So the first issue is immutable regexp result. The sample code below: var match = /quick\s(brown).+?(jumps)/ig.exec('The Quick Brown Fox Jumps Over The Lazy Dog'); match.shift() or match.slice() - often used in jquery. FYI, the second issue related with .net RegEx class and line endings handling (\r\n - \n) The two snippets below should produce the same results: var rheaders = /^(.?):[ \t]([^\r\n]*)$/mg; var rheaders = /^(.?):[ \t]([^\r\n]*)$/mg;
С уважением, |
Be aware that there are discrepancies between .NET and JS in terms of regular expressions evaluation. There are some unit tests from ECMA that are ignored in Jint's code base because of that. If you look into the skipped tests you will find which ones. |
I implemented everything with this PR: |
About multiline. What if source pattern contains escaped '' before '$'? Something like ".*$". Suggest to try this: var replaceRegex = new Regex(@"*$", RegexOptions.Compiled) ;
С уважением, |
Good catch, I will fix it. |
RegExp result must be mutable array.