2018-10-10 22:03:03 +00:00
---
id: 587d7db8367417b2b2512ba1
2021-02-06 04:42:36 +00:00
title: Match All Non-Numbers
2018-10-10 22:03:03 +00:00
challengeType: 1
2020-08-04 07:14:01 +00:00
forumTopicId: 301347
2021-01-13 02:31:00 +00:00
dashedName: match-all-non-numbers
2018-10-10 22:03:03 +00:00
---
2020-12-16 07:37:30 +00:00
# --description--
2021-02-06 04:42:36 +00:00
The last challenge showed how to search for digits using the shortcut `\d` with a lowercase `d` . You can also search for non-digits using a similar shortcut that uses an uppercase `D` instead.
2020-12-16 07:37:30 +00:00
2021-02-06 04:42:36 +00:00
The shortcut to look for non-digit characters is `\D` . This is equal to the character class `[^0-9]` , which looks for a single character that is not a number between zero and nine.
2020-12-16 07:37:30 +00:00
# --instructions--
2021-02-06 04:42:36 +00:00
Use the shorthand character class for non-digits `\D` to count how many non-digits are in movie titles.
2020-12-16 07:37:30 +00:00
# --hints--
2021-02-06 04:42:36 +00:00
Your regex should use the shortcut character to match non-digit characters
2020-12-16 07:37:30 +00:00
```js
assert(/\\D/.test(noNumRegex.source));
```
2021-02-06 04:42:36 +00:00
Your regex should use the global flag.
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert(noNumRegex.global);
```
2021-02-06 04:42:36 +00:00
Your regex should find no non-digits in `"9"` .
2020-12-16 07:37:30 +00:00
```js
assert('9'.match(noNumRegex) == null);
2018-10-10 22:03:03 +00:00
```
2021-02-06 04:42:36 +00:00
Your regex should find 6 non-digits in `"Catch 22"` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert('Catch 22'.match(noNumRegex).length == 6);
```
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
Your regex should find 11 non-digits in `"101 Dalmatians"` .
2018-10-10 22:03:03 +00:00
```js
2020-12-16 07:37:30 +00:00
assert('101 Dalmatians'.match(noNumRegex).length == 11);
2018-10-10 22:03:03 +00:00
```
2021-02-06 04:42:36 +00:00
Your regex should find 15 non-digits in `"One, Two, Three"` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert('One, Two, Three'.match(noNumRegex).length == 15);
```
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
Your regex should find 12 non-digits in `"21 Jump Street"` .
2018-10-10 22:03:03 +00:00
2020-12-16 07:37:30 +00:00
```js
assert('21 Jump Street'.match(noNumRegex).length == 12);
```
2018-10-10 22:03:03 +00:00
2021-02-06 04:42:36 +00:00
Your regex should find 17 non-digits in `"2001: A Space Odyssey"` .
2018-10-10 22:03:03 +00:00
```js
2020-12-16 07:37:30 +00:00
assert('2001: A Space Odyssey'.match(noNumRegex).length == 17);
2018-10-10 22:03:03 +00:00
```
2020-08-04 07:14:01 +00:00
2021-01-13 02:31:00 +00:00
# --seed--
## --seed-contents--
```js
let movieName = "2001: A Space Odyssey";
let noNumRegex = /change/; // Change this line
let result = movieName.match(noNumRegex).length;
```
2020-12-16 07:37:30 +00:00
# --solutions--
2021-01-13 02:31:00 +00:00
```js
let movieName = "2001: A Space Odyssey";
let noNumRegex = /\D/g; // Change this line
let result = movieName.match(noNumRegex).length;
```