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

Case insensitive string matching #10

Open
srgraham opened this issue Jun 22, 2016 · 1 comment
Open

Case insensitive string matching #10

srgraham opened this issue Jun 22, 2016 · 1 comment

Comments

@srgraham
Copy link

srgraham commented Jun 22, 2016

It would be useful to match certain strings but ignore cases. It would basically do the same as string or charSequence, but match against .toLowerCase() instead of an exact match.

Languages like SQL have all their keywords case-insensitive, so SELECT, select, and SeLeCt are all valid, but writing a rule for that can end up looking kinda messy.

A rule like i('str') could be made that does this, however it could cause confusion since it would only work when passing a string or charSequence. People may think they could pass results of other rules to it, which would not work. So perhaps one of these ways to write a case insensitive string would be useful?:

select = i'select'
select = 'select'i
select = i"select"
select = "select"i
@xixixao
Copy link
Owner

xixixao commented Jul 10, 2016

Hmm, what about

select = /select/i

That might be more general, if we allowed matching on any regex. Otherwise your i rule sounds like a fine solution.

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