DEV Community

Discussion on: Getting Started with Regular Expressions

Collapse
 
alexkapustin profile image
Oleksandr

Didn't read all, just till:

const reMatchThree = /(?:\s|^)(three)(?:\s||.|,|;|:|'|"|!|"|'|$)/g

Why don't you simply use:

const reMatchThree = /\b(three)\b/g

?

Collapse
 
nickytonline profile image
Nick Taylor • Edited

I completely forgot about word boundaries while I was writing it late at night lol. I’ve updated the article. Thanks for this. 😎