separate regular expression from `preg_match` function