1.0.0 • Published 8 years ago
index-of-regex v1.0.0
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
1.0.0
8 years ago