index-of-regex

1.0.0 • Public • Published

index-of-regex

Install

npm i index-of-regex

Usage

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

Readme

Keywords

Package Sidebar

Install

npm i index-of-regex

Weekly Downloads

3

Version

1.0.0

License

MIT

Last publish

Collaborators

  • capaj