List all separate words in a given text, excluding special characters
const text = 'Hello, I am a string. I have different words.' const pattern = /[^\w]/g const textWords = text.split(pattern).filter(Boolean) console.log(textWords) // ["Hello", "I", "am", "a", "string", "I", "have", "different", "words"]