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
- .verticalTab
- .formFeed
- .backspace
- .nullByte
- .anyOf
- .capture
- .namedCapture(name)
- .backreference(index)
- .namedBackreference(index)
- .group
- .end()
- .assertAhead
- .assertNotAhead
- .assertBehind
- .assertNotBehind
- .optional
- .zeroOrMore
- .zeroOrMoreLazy
- .oneOrMore
- .oneOrMoreLazy
- .exactly(n)
- .atLeast(n)
- .between(x, y)
- .betweenLazy(x, y)
- .startOfInput
- .endOfInput
- .anyOfChars(chars)
- .anythingBut
- .anythingButChars(chars)
- .anythingButString(str)
- .anythingButRange(a, b)
- .string(s)
- .char(c)
- .controlChar(c)
- .hexCode(hex)
- .utf16Code(hex)
- .unicodeCharCode(hex)
- .unicodeProperty(property)
- .notUnicodeProperty(property)
- .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…
Top comments (1)
OMG. Where was this thing all my life.