a basic regular expression matcher