diff options
author | Sajan Parikh <sajan@noppix.com> | 2013-02-02 15:00:39 +0100 |
---|---|---|
committer | Sajan Parikh <sajan@noppix.com> | 2013-02-02 15:00:39 +0100 |
commit | 2d1608a6325d55ab31c55c27c31052c2daa76e46 (patch) | |
tree | 79c8b52a7a377753e98ef1984c04863a0c471863 /system/libraries | |
parent | 2ccb60ed153a7c86c31a230c08bd42f22111398a (diff) |
Added Form Validation rule for alphanum + spaces.
Signed-off-by: Sajan Parikh <sajan@noppix.com>
Diffstat (limited to 'system/libraries')
-rw-r--r-- | system/libraries/Form_validation.php | 15 |
1 files changed, 15 insertions, 0 deletions
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 @@ -1230,6 +1230,21 @@ class CI_Form_validation { } // -------------------------------------------------------------------- + + // -------------------------------------------------------------------- + + /** + * Alpha-numeric w/ spaces + * + * @param string + * @return bool + */ + public function alpha_numeric_spaces($str) + { + return (bool) preg_match('#^[A-Z0-9 ]+$#i', $str); + } + + // -------------------------------------------------------------------- /** * Alpha-numeric with underscores and dashes |