ufukomer / search-nth

Executes a search for nth match

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

search-nth

Executes a search for nth match

The search-nth founds a pattern in a string, and then returns index of nth match. Similar to search() method.

Install

npm install --save search-nth

Usage

const search = require('search-nth');

const pattern = /\b\d+\b/;
const date = '21 2017 16:59:11';

search(date, pattern, 2)
//=> 3

License

MIT © Ömer Ufuk Efendioğlu

About

Executes a search for nth match

License:MIT License


Languages

Language:JavaScript 100.0%