--- id: 5d712346c441eddfaeb5bdef title: Match All Numbers challengeType: 1 forumTopicId: 18181 localeTitle: Совпадение всех номеров --- ## Description
Вы узнали ярлыки для общих строковых шаблонов, таких как alphanumerics. Другой общий шаблон - это просто цифры или цифры. Ярлык для поиска цифровых символов - \d , с нижним регистром d . Это равно классу символов [0-9] , который ищет один символ любого числа от нуля до девяти.
## Instructions
Используйте класс сокращенного символа \d чтобы подсчитать, сколько цифр указано в названиях фильмов. Письменные номера («шесть» вместо 6) не учитываются.
## Tests
```yml tests: - text: Your regex should use the shortcut character to match digit characters testString: assert(/\\d/.test(numRegex.source)); - text: Your regex should use the global flag. testString: assert(numRegex.global); - text: Your regex should find 1 digit in "9". testString: assert("9".match(numRegex).length == 1); - text: Your regex should find 2 digits in "Catch 22". testString: assert("Catch 22".match(numRegex).length == 2); - text: Your regex should find 3 digits in "101 Dalmatians". testString: assert("101 Dalmatians".match(numRegex).length == 3); - text: Your regex should find no digits in "One, Two, Three". testString: assert("One, Two, Three".match(numRegex) == null); - text: Your regex should find 2 digits in "21 Jump Street". testString: assert("21 Jump Street".match(numRegex).length == 2); - text: 'Your regex should find 4 digits in "2001: A Space Odyssey".' testString: 'assert("2001: A Space Odyssey".match(numRegex).length == 4);' ```
## Challenge Seed
```js let movieName = "2001: A Space Odyssey"; let numRegex = /change/; // Change this line let result = movieName.match(numRegex).length; ```
## Solution
```js let movieName = "2001: A Space Odyssey"; let numRegex = /\d/g; // Change this line let result = movieName.match(numRegex).length; ```