increase code readability

Most changes are optical
Replaced on ereg with preg_match,
Merge pull request #16 from Zen4All/master

increase code readability