Today I'm going to try and regain some of the reputation I lost the other week when I blogged a "pro tip", which, it turns out, wasn't very pro at all. Talk about egg on my face!
In response to blog Dragon Cotterill pointed me to Sublime Text 2, which did was took me 5 steps in one very simple step. Doh.
I'm now a convert to Sublime Text and using for allsorts of stuff. It's worth a look at if you haven't seen it already.
Anyway, last week I needed to create a Domino-based dropdown list of countries of the world, along with their ISO-3166 codes. The list is available here.
After copy-pasting direct from that webpage in to Sublime Text I had was what you see below. Whereas, what I wanted was a list in the Notes-friendly format "Country Name|CODE".
Notice in the lower part of the shot above I've got the Search/Replace function open and have entered the following Regular Expression:
This looks for a two-letter code at the start of a line, followed by some whitespace, followed by some more text and then the end of a line. It returns matches to the parts inside parentheses as "group matches". In this case the first group match is the two digit code and the second is the country name.
In the "Replace With" box I've told it to change each line to be the group 2 match, then a vertical bar and then the group 1 match. The result looks like this:
And that's ready to paste directly in to a Notes field!