Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/capaj/index-of-regex
a tiny utility for indexOf and lastIndexOf methods that accept regexes based on http://stackoverflow.com/a/274094
https://github.com/capaj/index-of-regex
regex utility
Last synced: 8 days ago
JSON representation
a tiny utility for indexOf and lastIndexOf methods that accept regexes based on http://stackoverflow.com/a/274094
- Host: GitHub
- URL: https://github.com/capaj/index-of-regex
- Owner: capaj
- License: mit
- Created: 2016-10-24T14:07:14.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-05-29T14:12:02.000Z (over 5 years ago)
- Last Synced: 2024-10-17T07:37:50.227Z (21 days ago)
- Topics: regex, utility
- Language: JavaScript
- Size: 1.95 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# index-of-regex
## Install
```bash
npm i index-of-regex
```## Usage
```javascript
//es6
import {indexOfRegex, lastIndexOfRegex} from 'index-of-regex'const {indexOfRegex, lastIndexOfRegex} = require('index-of-regex')
const str = '123abcabc'
indexOfRegex(str, /ab/) // 3
lastIndexOfRegex(str, /ab/) //6
```
Both take `startPosition` as 3rd argument.Original credit to Jason Bunting: http://stackoverflow.com/a/274094