Skip to content

Instantly share code, notes, and snippets.

@Wind010
Last active October 5, 2020 23:21
Show Gist options
  • Select an option

  • Save Wind010/0b205ac52c3fde9574400254ba5b6af4 to your computer and use it in GitHub Desktop.

Select an option

Save Wind010/0b205ac52c3fde9574400254ba5b6af4 to your computer and use it in GitHub Desktop.
BFG Replace Examples
SomePassword # Replace literal string 'SomePassword' with '***REMOVED***' (default)
SomePassword==>examplePass # Replace with 'examplePass' instead
SomePassword==> # Replace with the empty string
regex:password=\w+==>password= # Replace, using a regex
regex:\r(\n)==>$1 # Replace Windows newlines with Unix newlines
regex:(?i)(passsWord)==> # Replace "password" insensitively
regex:\"Number\":\s+\"\d+\"==>"Number: "***REMOVED***" # Remove number after "Number":
# Ensure that multi-line flag is used (java -jar bfg.jar --multi-line-regex --replace-text bfg_replace.txt)
regex:(?s)-----BEGIN RSA PRIVATE KEY-----(.+)-----END RSA PRIVATE KEY-----==>REMOVED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment