Kebab file names

This commit is contained in:
Angelos Chalaris
2023-04-27 21:58:35 +03:00
parent 1d189c709a
commit 61200d90c4
440 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,22 @@
---
title: String is alphanumeric
tags: string,regexp
cover: mountain-lake-cottage-2
firstSeen: 2020-09-06T07:59:16+03:00
lastUpdated: 2020-10-20T23:02:01+03:00
---
Checks if a string contains only alphanumeric characters.
- Use `RegExp.prototype.test()` to check if the input string matches against the alphanumeric regexp pattern.
```js
const isAlphaNumeric = str => /^[a-z0-9]+$/gi.test(str);
```
```js
isAlphaNumeric('hello123'); // true
isAlphaNumeric('123'); // true
isAlphaNumeric('hello 123'); // false (space character is not alphanumeric)
isAlphaNumeric('#$hello'); // false
```