Implemented regex matching (untested).