In javascript, the String.search() returns the position (character index) of the character at the start of the match when there are multiple characters. Meaning, for example, if you try to regex search cde in abcdefghij, it returns 2 (where c is at) and not 4 (where e is at). How do I do this? I wouldn't just take the position, add by a fixed number, and you'll get the last character (Position + 2), that won't work if the match have varying length match.