added solution for a type of regex parser