refactor with regular expresion