We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6e1c82d commit 268e563Copy full SHA for 268e563
snippets/isAlphaNumeric.md
@@ -1,14 +1,14 @@
1
---
2
title: isAlphaNumeric
3
-tags: string,regexp,intermediate
+tags: string,regexp,beginner
4
5
6
Checks if a string contains only alphanumeric characters.
7
8
-Use `String.prototype.match()` to check if input string matches against alphanumeric regex pattern.
+Use `RegExp.prototype.test()` to check if input string matches against alphanumeric regex pattern.
9
10
```js
11
-const isAlphaNumeric = (str) => !!str.match(/^[a-z0-9]+$/gi);
+const isAlphaNumeric = str => /^[a-z0-9]+$/gi.test(str);
12
```
13
14
0 commit comments