Amateur at JavaScript here. I set my self-projects to help myself learn.
I usually find the answers on stackoverflow but several days of googling have not enlightened me on the following.
I’m trying to match whole words in sentences. I plan to do this to wrap the words in <span> tags.
The regex I’m using is
(\/?+<?+\w+<?+>?+)
seen in use here http://regex101.com/r/nT2yY4
If this code is run on the string this is a <span>string</span> It returns
- this
- is
- a
<span>string</span>
I'd like it to return
- this
- is
- a
<span>string</span>
while the string <span>two words</span> returns
<span>twowords</span>
also I'd like punctuation pulled split off as well so "this is a string." becomes
- this
- is
- a
- string
- .
