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

Improve --smart-case handling of meta-characters #672

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

timgimyee
Copy link
Contributor

For #670.

Ignore uppercase characters in regex meta-characters, character escapes, and other constructs. For example, --smart-case should see all lowercase here:

ack --smart-case '--s\x6Dart\Wcas\N{LATIN SMALL LETTER E}'

On the other hand, it will now see uppercase "M" and "E" here:

ack --smart-case '--s\115art-cas\x{0045}'

@petdance
Copy link
Collaborator

petdance commented Oct 19, 2018

Thanks, this could be very useful.

Can you tell us more about this? How it's working? What version of Perl is it requiring?

@petdance
Copy link
Collaborator

Before you make more changes, can we discuss this a bit please? I don't want you to make changes that I might not be able to take. Also, we should be looking at this on ack3 before ack2. ack2 might never get another release.

@timgimyee
Copy link
Contributor Author

Works by replacing/removing all backslashed escapes/sequences before checking if all lowercase. Requires 5.10 since it uses named captures ($+{capture}, $+{escape}, $+{octal}). Switch to $1, $2, etc... if earlier versions of Perl are required.

@petdance
Copy link
Collaborator

petdance commented Jul 5, 2019

This has been fixed in ack3. It won't be fixed in ack2 because there won't be more releases of ack2.

@petdance
Copy link
Collaborator

petdance commented Jul 5, 2019

You've taken a very different approach to your fix than what I implemented in ack3. Would you please look at my ack3 implementation and let me know if you see anything that I might have missed?

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

Successfully merging this pull request may close these issues.

None yet

2 participants