Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pfrazee/pauls-word-boundary
Find the word boundaries from a given position within a string
https://github.com/pfrazee/pauls-word-boundary
Last synced: 14 days ago
JSON representation
Find the word boundaries from a given position within a string
- Host: GitHub
- URL: https://github.com/pfrazee/pauls-word-boundary
- Owner: pfrazee
- Created: 2018-03-25T02:06:33.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2018-03-25T02:32:10.000Z (almost 7 years ago)
- Last Synced: 2024-11-30T15:58:09.447Z (about 1 month ago)
- Language: JavaScript
- Size: 28.3 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# pauls-word-boundary
Find the word boundaries from a given position within a string.
```js
const {findWordBoundary} = require('pauls-word-boundary')var str = 'https://github.com/pfrazee/pauls-word-boundary?foo=bar'
findWordBoundary(str, 2) // => {start: 0, end: 5} ('https')
findWordBoundary(str, 10) // => {start: 8, end: 13} ('github')
```Currently uses this regex to determine the word boundary: `/[^a-z0-9-]/i`