Skip to content
Advertisement

How do I remove a word that contains a dash from a text?

so I want to remove a word that contains a dash between them like off-campus alongside other things that I want to remove. here is my code so far.

JavaScript

so far it prints

CS is a wonderful class So WONDERFUL amazing class cleaver class must-remove

Advertisement

Answer

You could use the regex w+-w+, which means 2 words w+, separated by a dash, and you use

JavaScript
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement