DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 966,155 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in

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 Author • Edited on

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