A JS library for building regular expressions in (almost) natural language  ↦

I’ve seen tools like this one before, but every time I do I still pass them around because regular expressions are powerful but also quite unapproachable. With this library, you can chain together function calls describing how you think about a rule and it’ll generate the expression for you. Example!

const SuperExpressive = require('super-expressive');

const myRegex = SuperExpressive()
      .range('A', 'F')
      .range('a', 'f')
      .range('0', '9')

// Produces the following regular expression:

That matches and captures the value of a 16-bit hexadecmal number like 0xC0D3. Assuming this library generates clean, somewhat optimal expressions (which might be a big assumption), it’s a great way to learn how to write your own expressions over time.


Sign in or Join to comment or subscribe

0:00 / 0:00