Regular Expression matcher inspired after reading http://swtch.com/~rsc/regexp/regexp1.html