Skip to content

Regex, replace entire line on a hit. #532

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

Open
joshuagarrison opened this issue May 26, 2025 · 0 comments
Open

Regex, replace entire line on a hit. #532

joshuagarrison opened this issue May 26, 2025 · 0 comments

Comments

@joshuagarrison
Copy link

joshuagarrison commented May 26, 2025

I am looking to have BFG clean my repos. However I when a string is found instead of replace the string I want to replace the entire line of the file.

Take this example. I have several files over several repos with API keys in them.

<block> <APIKEY>HASH1</APIKEY> </block>

As I understand I would have to gather all "Hash1" "Hash2" "Hash3" etc in a large file and tell bfg to replace them. I simply want to replace the entire line with REDACTED LINE or some other string. when the string "<APIKEY>" is found.

The above is a made up example that can be applied to all the cases I have. I can bring out specific cases.

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

1 participant