regex-extra
TypeScript icon, indicating that this package has built-in type declarations

0.2.2 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i regex-extra

Weekly Downloads

40

Version

0.2.2

License

MIT

Unpacked Size

7.63 kB

Total Files

7

Last publish

Collaborators

  • alexzzz