var at = myString.indexOf("@", 1); var dot = myString.indexOf("@", at); if ((at != -1) && (dot != -1)) ...