improved RET regular expression