Skip to content

ufukomer/search-nth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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