https://github.com/alexzhang1030/regex-extra
Including missing essential functions for Regex
https://github.com/alexzhang1030/regex-extra
Last synced: 2 months ago
JSON representation
Including missing essential functions for Regex
- Host: GitHub
- URL: https://github.com/alexzhang1030/regex-extra
- Owner: alexzhang1030
- License: mit
- Created: 2023-01-03T05:39:11.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-12-20T09:43:04.000Z (over 1 year ago)
- Last Synced: 2025-02-15T10:35:52.772Z (3 months ago)
- Language: TypeScript
- Size: 789 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# regex-extra
[](https://www.npmjs.com/package/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.
```ts
const RE = /\d+/
const reg = new RegexExtra(RE)
```## Functions
### 1. findAt
```ts
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
```ts
function isMatch(str: string, start?: number, end?: number): boolean
```Pass string to check if the regex is matched.
### 3. captures
```ts
function captures(str: string, start?: number, end?: number): string[] | null
```Get all the captures.