Convert RegExRX native files to Markdown snippets
I love RegExRX for testing regular expressions. It has all the features I could want from such an app, including the ability to copy a working regex out prepared for a range of languages. It’s what I’ve stuck with for years.
As I experiment with my regexes, I’ll save them in RegExRX, creating a .regexrx
file in my Snippets folder (where Snibbets works). In order to make these searchable with Snibbets, I use a script to convert the XML-based .regexrx
file to a Markdown file with the flags, search string, and the replace string and test text if they exist. I turned this into a gem for anyone who should happen to run into such a need.
You can install the tool with gem install regexrx2md
. Once installed, just use regexrx2md -o MARKDOWN_DIRECTORY SOURCE_DIRECTORY
to output a bunch of Markdown files from a directory of .regexrx
files. You can also convert a single file just by providing a file link as the argument instead of a directory.
There are options for manipulating the filename, the Markdown template, and the output directory. See the docs for more info. While I hope this is useful to someone, it was something I useful enough to me to invest the time in, so it’s already paid off sufficiently. I just thought I’d share… just in case.