update regular expression matching solution