0.2.2 • Published 2 years ago
regex-extra v0.2.2
regex-extra

Including missing essential functions for Regex. (ESM Only)
Usage
construct core class with regex, and all the following functions are bind to the instance.
const RE = /\d+/
const reg = new RegexExtra(RE)Functions
1. findAt
interface FindAtResult {
value: string
end: number
}
function findAt(str: string, start?: number, end?: number): FindAtResult | nullPass start and end index to find the string.
2. isMatch
function isMatch(str: string, start?: number, end?: number): booleanPass string to check if the regex is matched.
3. captures
function captures(str: string, start?: number, end?: number): string[] | nullGet all the captures.