# Regexes

I really like regexes. They can do so much work for you! Sometimes I write some to do my work for me. And then I put them here for future reference:

Bracket not in separate line:

\S.*[{}]$\|[{}].\+ Delete whitespaces on end of line: s/\s\+$//

Incorrect spacing around assignment/comparison:

\S[\&|+=\!\-\*<>]=\|=[^ =]

Change “//” comments into”/* */” comments:

s/\/\/$$.*$$/\/\*\1\*\//g

Too long lines in C files:

grep -rP “.{81,}” find -name ‘*.c’