Skip to content

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