[go: up one dir, main page]

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 ability to pass metavariable regex through CLI #10470

Open
disconnect3d opened this issue Aug 21, 2024 · 0 comments
Open

Add ability to pass metavariable regex through CLI #10470

disconnect3d opened this issue Aug 21, 2024 · 0 comments
Labels
cli Semgrep CLI enhancement New feature or request feature:metavariable-regex

Comments

@disconnect3d
Copy link
Contributor

Hi,

I often use Semgrep inline patterns (semgrep --lang=<lang> --pattern='<pattern>' ./) for finding certain simple patterns in codebases (similarly to https://github.com/weggli-rs/weggli).

It would be awesome if the CLI would support passing in metavariable regexes through a flag (or multiple flags). If this is already allowed, I haven't found it (and then I would suggest improving the semgrep --help).

I found there is a way to hack this around, at least for matching strings via regex via the deprecated feature: https://semgrep.dev/docs/writing-rules/pattern-syntax#string-matching -- so that we can do something like semgrep --lang=go --pattern='"=~/^http://[^1]/"' ./. However, it would be nice to have a way to pass metavariable regexes in the long term.

@mjambon mjambon added enhancement New feature or request feature:metavariable-regex cli Semgrep CLI labels Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Semgrep CLI enhancement New feature or request feature:metavariable-regex
Development

No branches or pull requests

2 participants