Fix regex and use indexOf to check string ending