Skip to content
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

make case insensitive comparisons better #55

Closed
BurntSushi opened this issue Mar 11, 2015 · 1 comment
Closed

make case insensitive comparisons better #55

BurntSushi opened this issue Mar 11, 2015 · 1 comment

Comments

@BurntSushi
Copy link
Member

We should switch from equality comparison on the first character returned by {upper,lower}case iterators to "does this character match any character in the {upper,lower}case iterator."

BurntSushi added a commit that referenced this issue Mar 11, 2015
This is a very hacky fix to handling case insensitivity. It preserves
existing behavior by checking the first character returned by the
{upper,lower}case iterators.

We should switch from equality comparison to "does this character match
*any* character in the {upper,lower}case iterator." See #55.
@SimonSapin
Copy link
Contributor

For what it’s worth, in ES6, a regex with both i (case-insensitive) and u (better Unicode support) flags uses common and simple mappings from Unicode’s CaseFolding.txt. These mapping preserve the number of code points. Using full mapping instead of simple gives “more correct” results, but it can grow the number of code points.

Either way, case folding (for caseless matching) is not the quite as either lower-case or upper-case.

I didn’t manage to find a spec for what Perl does exactly (though I didn’t search very hard). The Python documentation is equally unhelpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants