Based on Ozan S. Yigit's implementation; for more information on source,
see regex_templ.c.

Generalization done by  Tibor 'Igor2' Palinkas in 2012

This project is placed in the Public Domain.
