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

Add a flag to anchor patterns in the input #1480

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

g2p
Copy link

@g2p g2p commented Jan 18, 2024

Adds a new flag:

--anchor <ANCHOR>
    By default, the search pattern for --regex and --fixed-strings can match any part of the
    input. (See the --full-path option for what constitutes input)
    
    This flag allows anchoring the pattern.
    
    Conflicts with the --glob flag: globs always match the entire input
    
    [possible values: input-start, input-end, input, word]

Closes #1476.

@tavianator
Copy link
Collaborator

I'll let @sharkdp decide if he wants this additional command-line flag. I will point out that --anchor={input,-{start,end}} could be made compatible with --glob by just adding * at the beginning or end as appropriate.

@sharkdp
Copy link
Owner

sharkdp commented Jun 23, 2024

I'll let @sharkdp decide if he wants this additional command-line flag.

I'd be okay with adding this new command-line option.

I will point out that --anchor={input,-{start,end}} could be made compatible with --glob by just adding * at the beginning or end as appropriate.

That would be great.

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.

More ways to anchor patterns
3 participants