Alnum()Alnum(string $additionalChars)
Validates alphanumeric characters from a-Z and 0-9.
v::alnum()->validate('foo 123'); // trueA parameter for extra characters can be used:
v::alnum('-')->validate('foo - 123'); // trueThis validator allows whitespace, if you want to
remove them add ->noWhitespace() to the chain:
v::alnum()->noWhitespace()->validate('foo 123'); // falseYou can restrict case using the ->lowercase() and
->uppercase() validators:
v::alnum()->uppercase()->validate('aaa'); // falseMessage template for this validator includes {{additionalChars}} as
the string of extra chars passed as the parameter.
| Version | Description |
|---|---|
| 0.3.9 | Created |
See also: