Another remark: what happen if the regex is not found ? maybe catch this possibility and in this case return a default error