Add code to regexp match

Add test for regexp match.
And, clean duplicated codes in match_test.