changed regex to solve some bugs