Trying to form a regular expression to match the pattern of keywords, the pattern I found is like
- remove all words before
:till a space occurs and all words after:till)occurs.
find the term in this jsfiddle.
var newInput="keyword2:(content2) app keyword1:(content1) sos keyword:(content) das sad";
Im looking for an output like
app,sos,das,sad
Explanation
[^:\s]+: # any character (except ' ' and ':') in front of ':' "keyword1:'" \([^)]*\) # any character enclosed in '(' ')' "(content2)" \s* # trailing spaces " "This returns a space-separated string. You would have to trim it and split at spaces (or replace them) yourself.