Is it possible to use a regular expression to search for all words within a sentence containing a substring?
Example:
var sentence = "hello my number is 344undefined848 undefinedundefined undefinedcalling whistleundefined";
I need to find all words in this sentence that contain "undefined" and delete these words.
Output should be "hello my number is ";
FYI - I'm currently tokenize (javascript) and repeat all tokens to find and delete, and then concatenate the final string. I need to use regex. Please, help.
Thank!
source
share