added ASCII check

This commit is contained in:
Roland Gruber 2010-05-07 19:10:46 +00:00
parent b7f90af60d
commit 353cfb5e35
1 changed files with 3 additions and 0 deletions

View File

@ -474,6 +474,9 @@ function get_preg($argument, $regexp) {
case 'ip': // IP address
$pregexpr = '/^[0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}[.][0-9]{1,3}$/';
break;
case 'ascii': // ASCII
$pregexpr = '/^[' . chr(1) . '-' . chr(128) . ']*$/';
break;
}
if ($pregexpr!='')
if (preg_match($pregexpr, $argument)) {