Last active
September 2, 2016 19:33
-
-
Save otac0n/8d69c5385e92815b19d08fec0628a4d1 to your computer and use it in GitHub Desktop.
Cleaning Regexes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove trailing whitespace: | |
Pattern: [ \t]+(?=[\r\n]) | |
Replace: "" | |
Replace tabs with spaces: | |
Pattern: (?<=^([^\t\r\n]{4})*)\t | |
Replace: " " | |
Pattern: (?<=^([^\t\r\n]{4})*[^\t\r\n]{1})\t | |
Replace: " " | |
Pattern: (?<=^([^\t\r\n]{4})*[^\t\r\n]{2})\t | |
Replace: " " | |
Pattern: (?<=^([^\t\r\n]{4})*[^\t\r\n]{3})\t | |
Replace: " " | |
Remove multiple blank lines: | |
Pattern: (?<=(\r\n){2})(\r\n)+ | |
Replace: "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment