match-at
Relocatable regular expressions.
Last updated 7 years ago by ariabuckles .
Repository · Bugs · Original npm · Tarball · package.json
$ gnpm install match-at 
SYNC missed versions from official npm registry.

match-at Build Status

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.

Current Tags

  • 0.1.1                                ...           latest (7 years ago)

2 Versions

  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           10 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (5)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |