summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
Diffstat (limited to 'system')
-rw-r--r--system/language/english/form_validation_lang.php1
-rw-r--r--system/libraries/Form_validation.php13
2 files changed, 14 insertions, 0 deletions
diff --git a/system/language/english/form_validation_lang.php b/system/language/english/form_validation_lang.php
index 3fb007dd2..7c0277c25 100644
--- a/system/language/english/form_validation_lang.php
+++ b/system/language/english/form_validation_lang.php
@@ -37,6 +37,7 @@ $lang['form_validation_max_length'] = 'The {field} field cannot exceed {param}
$lang['form_validation_exact_length'] = 'The {field} field must be exactly {param} characters in length.';
$lang['form_validation_alpha'] = 'The {field} field may only contain alphabetical characters.';
$lang['form_validation_alpha_numeric'] = 'The {field} field may only contain alpha-numeric characters.';
+$lang['form_validation_alpha_numeric_spaces'] = 'The {field} field may only contain alpha-numeric characters and spaces.';
$lang['form_validation_alpha_dash'] = 'The {field} field may only contain alpha-numeric characters, underscores, and dashes.';
$lang['form_validation_numeric'] = 'The {field} field must contain only numbers.';
$lang['form_validation_is_numeric'] = 'The {field} field must contain only numeric characters.';
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index bbd0b523e..1511d9add 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -1232,6 +1232,19 @@ 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
*
* @param string