match-at ![Build Status](https://camo.githubusercontent.com/e5a3217698fd978e761fd6e481901eb041bf459e3cd869c1d9ac1dc7d87e05b8/68747470733a2f2f7472617669732d63692e6f72672f73706963796a2f6d617463682d61742e7376673f6272616e63683d6d6173746572)
Introduction
Like String.prototype.match
if it only checked the regex at the given index instead of searching the entire string.
matchAt(/world/, 'hello world', 6); // ['world']
matchAt(/world/, 'hello world', 0); // null
Almost like 'hello world'.slice(i).match(/^world/)
except the resulting match object's .index
property corresponds to the original string, and it doesn't actually slice the string. Most engines optimize taking a substring so this probably isn't particularly valuable in practice, but it was an entertaining exercise and could be useful if you reminisce about these semantics.
License
MIT.