2015-01-30 09:40:06 +01:00
|
|
|
# Alnum
|
|
|
|
|
2017-03-27 14:47:07 +02:00
|
|
|
- `Alnum()`
|
2018-09-24 21:48:41 +02:00
|
|
|
- `Alnum(string ...$additionalChars)`
|
2015-01-30 09:40:06 +01:00
|
|
|
|
2018-09-03 22:42:38 +02:00
|
|
|
Validates whether the input is alphanumeric or not.
|
2015-01-30 09:40:06 +01:00
|
|
|
|
2018-09-03 22:42:38 +02:00
|
|
|
Alphanumeric is a combination of alphabetic (a-z and A-Z) and numeric (0-9)
|
|
|
|
characters.
|
2015-01-30 09:40:06 +01:00
|
|
|
|
|
|
|
```php
|
2018-09-03 22:42:38 +02:00
|
|
|
v::alnum()->validate('foo 123'); // false
|
|
|
|
v::alnum(' ')->validate('foo 123'); // true
|
|
|
|
v::alnum()->validate('100%'); // false
|
|
|
|
v::alnum('%')->validate('100%'); // true
|
2018-09-24 21:48:41 +02:00
|
|
|
v::alnum('%', ',')->validate('10,5%'); // true
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
2018-09-03 22:42:38 +02:00
|
|
|
You can restrict case using the [Lowercase](Lowercase.md) and
|
|
|
|
[Uppercase](Uppercase.md) rules.
|
2015-01-30 09:40:06 +01:00
|
|
|
|
|
|
|
```php
|
2018-09-03 22:42:38 +02:00
|
|
|
v::alnum()->uppercase()->validate('example'); // false
|
2015-01-30 09:40:06 +01:00
|
|
|
```
|
|
|
|
|
2018-09-03 22:42:38 +02:00
|
|
|
Message template for this validator includes `{{additionalChars}}` as the string
|
|
|
|
of extra chars passed as the parameter.
|
2015-01-30 09:40:06 +01:00
|
|
|
|
2019-05-11 18:32:13 +02:00
|
|
|
## Categorization
|
|
|
|
|
|
|
|
- Strings
|
|
|
|
|
2017-03-27 22:04:13 +02:00
|
|
|
## Changelog
|
|
|
|
|
|
|
|
Version | Description
|
|
|
|
--------|-------------
|
2018-09-03 22:42:38 +02:00
|
|
|
2.0.0 | Removed support to whitespaces by default
|
2017-03-27 22:04:13 +02:00
|
|
|
0.3.9 | Created
|
|
|
|
|
2015-08-20 06:38:41 +02:00
|
|
|
***
|
2015-01-30 09:40:06 +01:00
|
|
|
See also:
|
|
|
|
|
2017-03-28 11:53:14 +02:00
|
|
|
- [Alpha](Alpha.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Charset](Charset.md)
|
2017-03-28 11:53:14 +02:00
|
|
|
- [Consonant](Consonant.md)
|
2019-05-11 23:40:52 +02:00
|
|
|
- [Control](Control.md)
|
2020-10-05 12:49:14 +02:00
|
|
|
- [Decimal](Decimal.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Digit](Digit.md)
|
|
|
|
- [Lowercase](Lowercase.md)
|
|
|
|
- [NoWhitespace](NoWhitespace.md)
|
2019-01-27 01:14:47 +01:00
|
|
|
- [NotEmoji](NotEmoji.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Regex](Regex.md)
|
|
|
|
- [StringType](StringType.md)
|
|
|
|
- [StringVal](StringVal.md)
|
|
|
|
- [Uppercase](Uppercase.md)
|
2017-03-28 11:53:14 +02:00
|
|
|
- [Vowel](Vowel.md)
|
2018-12-11 13:31:50 +01:00
|
|
|
- [Xdigit](Xdigit.md)
|