CodeIgniter Forums
Additional rule for Validation - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forumdisplay.php?fid=29)
+--- Thread: Additional rule for Validation (/showthread.php?tid=72222)



Additional rule for Validation - HardyW - 11-23-2018

CodeIgniter has a few roles related to restrict the input to alphanumeric characters. But it does not have a standard rule to limit the input for identifiers. You can of course use regular expressions (like [_a-zA-Z][_a-zA-Z0-9]*) but a native rule would be convenient and has a broad usage, I believe.

Regards,
Hardy


RE: Additional rule for Validation - ciadmin - 03-06-2019

Doesn't the "alpha_dash" validation rule do this already?
See https://codeigniter4.github.io/CodeIgniter4/libraries/validation.html#available-rules


RE: Additional rule for Validation - HardyW - 03-06-2019

(03-06-2019, 11:49 AM)ciadmin Wrote: Doesn't the "alpha_dash" validation rule do this already?
See https://codeigniter4.github.io/CodeIgniter4/libraries/validation.html#available-rules

No, not according to the documentation and not according to the implementation: an identifier may not begin with a dash or a number!