-
Notifications
You must be signed in to change notification settings - Fork 60
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
Character classe ranges can be passed in reverse order, meaning that Re.Pcre
is not perl-compatible
#186
Comments
Thanks, that looks like a bug indeed. Would you mind sending a PR to do the validation? What about |
Addressed in the next release |
oh goodness, sorry I never came back and responded to your questions! thanks for coming back to the issue regardless :) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cset.seq
compares its two arguments and, if the first argument is greater than the second argument, reverses their order: https://github.com/ocaml/ocaml-re/blob/master/lib/cset.ml#L74This means that
Re.Pcre.regexp
will accept arguments like[9-0]
- which will be automatically converted to[0-9]
. This is inconsistent with perl's behavior, e.g:(I'm not very familiar with the code-base, but it seems like another potential place that this could be addressed is when perl.ml parses character-classes, by adding some validation before creating a range)
This is a pretty minor bug, but can result in confusing behavior for typos like
[0- 9]
- whichRe.Pcre.regexp
will parse happily.The text was updated successfully, but these errors were encountered: