Translates (deprecated) POSIX functions to PCRE, fixing #441

Fixes issue #441.

> **eregi()** was deprecated at PHP 5.3 in favor of the PCRE extension. The use of **eregi()** can cause warnings in some scenarios. 

This patch translates the old eregi() functions to preg_match() (including the **i** / **PCRE_CASELESS** modifier).

It also casts the result to integer to be absolutely 100% sure the value is saved as an integer.