I asked Andrew to point out a few differences between Verbal Expressions and his offering. He replied,
RegExpBuilder allows you to specify all kinds of quanitites, whereas VerbalExpressions has focused on just a couple of situations (either it might have something, or it does have something). So in RegExpBuilder you can say "it has between 3 and 100", or it has "at least 7" or it has "at most 5" of something. There are all kinds of ways of specifying quantity. Eg:
var regex = new RegExpBuilder() .startOfLine() .then("thechangelog is ") .max(7).of("really ") .then("cool") .getRegExp(); regex.test("thechangelog is really really really cool"); // true
VerbalExpressions is mostly limited to working with strings. So for example, you pass in "http" to then("http"), but unless your regular expression is very linear, you will have to deal with groups of patterns, and work with patterns themselves. RegExpBuilder allows you to pass in and work with patterns themselves, so you can do eitherLike(pattern1).orLike(pattern2), for example. Eg:
var pattern = new RegExpBuilder() .either("massively ") .or("amazingly "); var regex = new RegExpBuilder() .startOfLine() .then("thechangelog is ") .max(7).like(pattern) .then("cool") .getRegExp(); regex.test("thechangelog is massively massively massively cool"); // true
RegExpBuilder also has support for character classes (like letters, digits, etc), and advanced features like lookaheads
It’s nice to see some friendly competition in this space to push us all to greater heights.
RegExpBuilder is MIT licensed and hosted on GitHub.