the function for Regular Expression Match
a refactor
a refactor and some added function