I discover that repo when checking on Github for morning coffee
seem interesting
francisrstokes / super-expressive
🦜 Super Expressive is a zero-dependency JavaScript library for building regular expressions in (almost) natural language
Super Expressive
Super Expressive is a JavaScript library that allows you to build regular expressions in almost natural language - with no extra dependencies, and a lightweight code footprint (less than 4kb with minification + gzip!).
-
Click to expand
- SuperExpressive()
- .allowMultipleMatches
- .lineByLine
- .caseInsensitive
- .sticky
- .unicode
- .singleLine
- .anyChar
- .whitespaceChar
- .nonWhitespaceChar
- .digit
- .nonDigit
- .word
- .nonWord
- .wordBoundary
- .nonWordBoundary
- .newline
- .carriageReturn
- .tab
- .nullByte
- .anyOf
- .capture
- .namedCapture(name)
- .backreference(index)
- .namedBackreference(index)
- .group
- .end()
- .assertAhead
- .assertNotAhead
- .optional
- .zeroOrMore
- .zeroOrMoreLazy
- .oneOrMore
- .oneOrMoreLazy
- .exactly(n)
- .atLeast(n)
- .between(x, y)
- .betweenLazy(x, y)
- .startOfInput
- .endOfInput
- .anyOfChars(chars)
- .anythingButChars(chars)
- .anythingButString(str)
- .anythingButRange(a, b)
- .string(s)
- .char(c)
- .range(a, b)
- .subexpression(expr, opts)
- .toRegexString()
- .toRegex()
Why?
Regex is a very powerful tool, but its terse and cryptic vocabulary can make constructing and communicating them with others a challenge. Even developers who understand them well can have trouble reading their own back just a few months later! In addition, they can't be easily created and manipulated…
Top comments (1)
OMG. Where was this thing all my life.