Stop writing Regular Expressions. Express them with Verbal Expressions.
GitHub user jehna has fashioned a runaway hit with his unique way of constructing difficult regular expressions.
VerbalExpressions turns the often-obscure-and-tricky-to-type regular expression operators into descriptive, chainable functions. The result of this is quite astounding. Here’s the example URL tester from the README:
var tester = VerEx()
.startOfLine()
.then( "http" )
.maybe( "s" )
.then( "://" )
.maybe( "www." )
.anythingBut( " " )
.endOfLine();
This style may be off-putting to old-school regex pros, but even they would have to admit that it’s quite approachable and easy to reason about.
The main project is a JavaScript library, but in the world of open source the more success you have, the more ports you get.
VerbalExpressions has been ported to so many other languages that a GitHub organization was created just to host them all. I think this idea struck a real nerve.
Discussion
Sign in or Join to comment or subscribe