I need to remove 2 words from a string. The words are _with
and _and
so raised_hand_with_fingers_and_splayed
becomes raised_hand_fingers_splayed
The regex /_with|_and/
appears to work in https://regexr.com/ but when I use it with JavaScript only the _with
is removed:
const str = `raised_hand_with_fingers_and_splayed`;
const newStr = str.replace(/_with|_and/,"")