Generation

generate functionSun, 13 Nov 2022

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"]

TypeScript
Generate More

Want to kickstart your project?Use the new AI Studio to create your code