You only get earth as a match because the regex engine has matched earth as the first alternative and then moved on in the source string, oblivious to the fact that you could also have matched ear or art. This is expected behavior with all regex engines - they don't try to return all possible matches, just the first one, and matches generally can't overlap.
Whether earth or ear is returned depends on the regex engine. A POSIX ERE engine will always return the leftmost, longest match, whereas most current regex engines (including JavaScript's) will return the first possible match, depending on the order of alternation in the regex.
So art|earth|ear would return earth, whereas ear|art|earth would return ear.
You can make the regex find overlapping matches (as long as they start in different positions in the string) by using positive lookahead assertions:
(?=(ear|earth|art))
will find ear and art, but not earth because it starts at the same position as ear. Note that you must not look for the regex' entire match (regsult[0] in your code) in this case but for the content of the capturing group, in this case (regsult[1]).
The only way around this that I can think of at the moment would be to use
(?=(ear(th)?|art))
which would have a result like [["", "ear", "th"], ["", "art", undefined]].
RegExpintondifferent RegExp (wherenis the number of words) and then run each RegExp on the sentence to know the words which are present in the text. Also if you are looking for exact match for words you can use simple string match withindexOfrather than RegExp. Eg fiddle: jsfiddle.net/vtxk3zdn