3 ms·
I'd love to learn more about writing regexps with various kinds of ranges. I don't see the issue, but it's very likely that I'm missing something.
by anonymoushn 4y ago
I'd love to learn more about writing regexps with various kinds of ranges. I don't see the issue, but it's very likely that I'm missing something.
- patrec 4y agoHere's what a regexp for a C-style identifier looks like (ranges are inclusive): [a-zA-Z_][a-zA-Z0-9_]* Here's what the same regexp would look like if regexp ranges were end-exclusive: [a-{A-[][a-{A-[0-:_]* Do you see the issue now? Of course if regexps really worked that way, you'd be better off doing this instead: [a-zzA-ZZ][a-zzA-ZZ0-99_] But that specific trick only works because regexp ranges occur in a set union context.
- deleted 4y ago[deleted]
- anonymoushn 4y agoI see, the `a-z` range has an inclusive upper bound. That makes sense and it really should be like that.