1.1.1 ā¢ Published 3 years ago
theregex v1.1.1
Readme
Another JS/TS regexes with more feature!
Usage
import regex from 'theregex'
const oldSchool = /abc/
const withFlags = /def/gm
const myTheRegex = regex`\x42{5}`
const myCaseInsensitiveRegex = regex('i')`
^
${oldSchool} # seamlessly interpolate other regexes
${myTheRegex} # also works if the other regex is fancy
${withFlags} # flags ignored when interpolated
\w\d\b\0\\ # look Mom, no double escaping!
...
\r\n\t\x20 # use "\x20" to match a literal space
$
`
console.log(myCaseInsensitiveRegex)
// /^abc\x42{5}def\w\d\b\0\\...\r\n\t\x20$/i
const myRegexWithOptions = regex({
unicode: true,
global: true,
})`
^
š©+ # with unicode enabled, this matches by codepoint
$
`
console.log(myRegexWithOptions)
// /^š©+$/gu