Add regular expression
fixed some bugs