0.2.2 • Published 5 months ago

regex-extra v0.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

regex-extra

NPM version

Logo

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 | null

Pass start and end index to find the string.

2. isMatch

function isMatch(str: string, start?: number, end?: number): boolean

Pass string to check if the regex is matched.

3. captures

function captures(str: string, start?: number, end?: number): string[] | null

Get all the captures.

0.2.1

5 months ago

0.2.2

5 months ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.0.0

1 year ago