Regex Pattern Structure Javascript Substring Index