changing back to RegExp.exec