Cleaning of code.

Removing of old smatch methods and unification of sregexp function
using template.