I need to search a thesaurus such as
var thesaurus = "@,disappear,dematerialise,vanish,@,fat,massive,immense,@"
and return all synonyms (the words between @ seperated by commas)
I came up with:
regex = ("@.*," +words[i]+ ".*?(?=@)");
matchArray = thesaurus.match(regex);
synonymLine = matchArray[0];
synonymLine = synonymLine.slice(2, -1); //removes start @, and end ,
essentially its matching the thesaurus for @.*,fat,.*@ problem is: it returns whole string from first @ to @ after word searched
so I need to: make it just get the synonyms that apply to the word
related javascript problem: Couldn't create a multi-line string so I made the thesaurus all one line. Anyone know a workaround for both problems