Something that I seem to regularly forget about when re-factoring code is the wondrous:
query-replace-regexp. Although what really screws me up is that every damn time I do remember, I can never get the damn emacs flavor of regex syntax right.
My first experience with regex was with Perl, and my current experiences with PHP and Python have not deviated too much (I believe they even use the Perl regex engine)[Citation Needed, probably bullshit]. But in emacs there are some key differences that will screw you real fast. First thing is character classes, you don’t have the comforting familiarity of ‘\w’ and ‘\d’, instead you have ‘[[:word:]]’, ‘[[:digit:]]’, and so on.
The other aspect that throws me off every time is the syntax for capturing patterns and using the matches. Typically I would put what I want to capture in parentheses then reuse it with the ‘$[Capture #]’ notation. When attempting this in emacs, you always have to escape the parentheses: ‘([[:digit:]]+)’ then access the capture with ‘[Capture #]’.
I know this is a fairly small thing to worry about, but it would be nice of something as ubiquitous as regular expression syntax could be more standard so I don’t spend 10 minutes every time I try to use it dumbfounded by why my wicked awesome regex didn’t work.
Thank goodness for
regexp-builder though, alone it makes up for any other issues I could possibly have with emacs and regex.