Skip to content

Find the word boundaries from a given position within a string

Notifications You must be signed in to change notification settings

pfrazee/pauls-word-boundary

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pauls-word-boundary

Find the word boundaries from a given position within a string.

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

About

Find the word boundaries from a given position within a string

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published