string or regex to match before
Optional
flags: stringregex flags - 'g' and 's' are always added to whatever flags are passed.
A regular expression that matches text between the left and right patterns.
The function accepts either strings or regular expressions as the left and right patterns. If a string is provided, it will be escaped to form a valid regular expression. The function also accepts an optional flags parameter to specify regular expression flags.
const regex = createEncapsulatingRegex(/a/, /b/)
'abc'.match(regex)?.groups?.mid // 'c'
Generated using TypeDoc
Builds a regex that matches a string between two provided strings. Supports regex as boundaries as well.