From 2d1608a6325d55ab31c55c27c31052c2daa76e46 Mon Sep 17 00:00:00 2001 From: Sajan Parikh Date: Sat, 2 Feb 2013 08:00:39 -0600 Subject: Added Form Validation rule for alphanum + spaces. Signed-off-by: Sajan Parikh --- system/libraries/Form_validation.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'system/libraries/Form_validation.php') diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php index bbd0b523e..7b9215c04 100644 --- a/system/libraries/Form_validation.php +++ b/system/libraries/Form_validation.php @@ -1229,6 +1229,21 @@ class CI_Form_validation { return ctype_alnum((string) $str); } + // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- + + /** + * Alpha-numeric w/ spaces + * + * @param string + * @return bool + */ + public function alpha_numeric_spaces($str) + { + return (bool) preg_match('#^[A-Z0-9 ]+$#i', $str); + } + // -------------------------------------------------------------------- /** -- cgit v1.2.3-24-g4f1b