Frak also generates regular expressions for you, but it does it in a completely different way. With Frak, you don’t write an expression to match string patterns. Instead, you give it a set of strings and it generates an expression which matches them.
Frak is written in Clojure, so you install it by adding a dependency to your
To use it, simply require it, pass it a collection of strings, and it will return the resulting regular expression:
user> (require 'frak) nil user> (frak/pattern ["foo" "bar" "baz" "quux"]) #"(?:ba[rz]|foo|quux)" user> (frak/pattern ["Clojure" "Clojars" "ClojureScript"]) #"Cloj(?:ure(?:Script)?|ars)"
Have comments? Send a tweet to @TheChangelog on Twitter.
Subscribe to The Changelog Weekly – our weekly email covering everything that hits our open source radar.