Skip to content

should RegexBuilder::case_sensitive(false) be added as an alias for RegexBuilder::case_insensitive(true)? #1209

Answered by BurntSushi
dciug asked this question in Q&A
Discussion options

You must be logged in to vote

If I were starting over, I might be inclined to use case_sensitive rather than case_insensitive. However, crucially, the actual regex flag is i, which means "opt into case insensitive matching." In this way, RegexBuilder is matching the conceptualization prompted by the syntax. And changing the i to something else is a much more difficult change. For example, since case sensitive matching is generally expected to be enabled by default, it would imply doing something like (?-X) (where X is the flag that means "enable case sensitive matching") to get case insensitive matching.

But as for now, no, I actually think having both is worse than having one. When you have both, folks start wonderin…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by BurntSushi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants