-
Notifications
You must be signed in to change notification settings - Fork 18k
regexp/syntax: [a-y]
parses as [a-z]
with (?i)
#73456
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
Comments
Related Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
This may not be a bug. In the first example, |
I considered that. I'd expect
|
The difference is whether it includes l-z. |
I don't follow. It seems unexpected that |
Consider the minimal example It may be confusing that without |
Thanks for your insights, @adonovan! |
Go version
go version go1.24.2 linux/amd64
Output of
go env
in your module/workspace:`go env` output
What did you do?
I was writing test cases to detect "strange" character class ranges (i.e., a user does
=-_
and inadvertently creates a range). It appears there is a bug with howsyntax.Parse
handles character ranges in conjunction with(?i)
.https://go.dev/play/p/2p8l3zJi-4T
Note:
[a-x]
reference in the title refers to any range other thana-z
.What did you see happen?
The pattern
(?i)[a-l0-9=-_]
is parsed asa-z
and nota-l
as expected.What did you expect to see?
All patterns are printed as
[a-l]
.The text was updated successfully, but these errors were encountered: