summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-27 11:04:24 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-27 11:04:24 +0200
commitacb962e5aa6fb607751dc2012ff6df25acbd518b (patch)
treefaf96c4b915a5ea85336df9f4eb25a618a1a0578
parent70f94006326196e4c5b79843c0f8e91984caa593 (diff)
Use ctype_* functions in Form_validation instead of PCRE when possible
-rw-r--r--system/libraries/Form_validation.php8
1 files changed, 4 insertions, 4 deletions
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index e7b89d0c4..8e03e91f3 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1129,7 +1129,7 @@ class CI_Form_validation {
*/
public function alpha($str)
{
- return (bool) preg_match('/^[a-z]+$/i', $str);
+ return ctype_alpha($str);
}
// --------------------------------------------------------------------
@@ -1142,7 +1142,7 @@ class CI_Form_validation {
*/
public function alpha_numeric($str)
{
- return (bool) preg_match('/^[a-z0-9]+$/i', $str);
+ return ctype_alnum((string) $str);
}
// --------------------------------------------------------------------
@@ -1264,7 +1264,7 @@ class CI_Form_validation {
*/
public function is_natural($str)
{
- return (bool) preg_match('/^[0-9]+$/', $str);
+ return ctype_digit((string) $str);
}
// --------------------------------------------------------------------
@@ -1277,7 +1277,7 @@ class CI_Form_validation {
*/
public function is_natural_no_zero($str)
{
- return ($str != 0 && preg_match('/^[0-9]+$/', $str));
+ return ($str != 0 && ctype_digit((string) $str));
}
// --------------------------------------------------------------------