txt2regex: A regex newbie’s best friend

Not just newbies either: It’s probably easier to build and deconstruct complex regex patterns with txt2regex than just to muddle through.

2014-06-05-6m47421-txt2regex-01 2014-06-05-6m47421-txt2regex-02

Unless you’re some kind of regex wizard. Some kind of regex grand pooh-bah. Unless you decide how you’ll get to the grocery store with regex snippets. In that case, you probably don’t need to be visiting this site. 👿

txt2regex is probably one of the coolest little terminal toys I’ve seen in a while. txt2regex will step through your logic and build up a pattern piece by piece, offering the appropriate options at the right locations.

txt2regex also tailors its results to any of about 12 or more different programs or languages, meaning you can get results for vim and python, and not have to think about trying to spot differences between them.

If you look at the second screenshot up there, you can see that not only does txt2regex spit out a natural speech rendition of your pattern, but also provides for a history tool, so you can come back and edit your attempt, if something didn’t work how you wanted.

That means you don’t have to retype all your failed attempts, just to get back to your workable state. Nifty.

txt2regex is not a new program; the home page suggests it has been around for at least 10 years. I suspect it is very much under the radar though, quite possibly because it doesn’t really come into use until a person reaches a certain degree of computer proficiency. I don’t think txt2regex would have thrilled me back when I was just a Linux newb. (Who am I kidding? I still am a newb.)

But now, it’s a very clever, very useful tool, and I plan on keeping it around. You know how I am about programs with color. … 🙂

Advertisements