Regular expressions engine in scala