Tony Aldon has a nice follow on to his video on regular expression string replacement. In that first video, he mentioned the visual-regexp package as a way of building a regular expression interactively. At the time, I thought that it as pretty much what you get from the builtin re-builder command but maybe a little easier to use.
In his latest video, Aldon shows how to use re-builder
to help build a function that searches with a semi-complicated regular expression and replaces parts of the matched strings. The details of the strings and their replacements don’t matter; they’re just a convenient vehicle to illustrate the process.
One of the really nice things about re-builder
is that you can easily change the input method and re-builder
will automatically translate the regex back to standard notation when you save it. If you get confused by multiple backslashes and when to use them, this can make working with Emacs regular expressions easier.
Likewise, it’s easy to toggle whether or not the regular expression should ignore case. It’s a simple keystroke; you don’t need to manually change the value of case-fold-search
.
Aldon demonstrates all this in his video. The shortcuts he uses—other than the one to start re-builder
itself—are the default ones so it’s a good way to learn the package.
The video is just shy of 32 minutes so plan accordingly.