I would like to remove all occurrences of the words "hello" and "-hello" in a string, the "-" in "-hello" is a minus sign.
I am currently doing it as such
let regex = /hello/-hello/g
let word = "Hello, How are -hello you doing"
let newWord = word.replace(regex,'')
But this seems to throw an error, what is that correct way to do this?
thank you
regex = /-?\bhello\b/gregex = /(-?hello)/gi/instead of|. The/after hello closes the regex literal.