expressive-tsis a functional programming library designed to simplify building complex regular expressions.
Table of contents
npm install fp-ts expressive-ts
yarn add fp-ts expressive-ts
fp-ts is a peer dependency of
The expressive nature of the
expressive-ts API makes it incredibly easy to understand the purpose of an otherwise cryptic regular expression. Function composition is a core component of the API. By composing together the various functions provided by
expressive-ts, extremely complex regular expressions can be built easily.
Lets imagine that we would like to recognize and validate a basic URL. Here's how it would look using
assert.strictEqualexpression.test'', trueassert.strictEqualexpression.test'', trueassert.strictEqualexpression.test'', trueassert.strictEqualexpression.test'http:/google.com', falseassert.strictEqualexpression.test' le.com', false