update regular expression and add logging