--- id: 587d7db4367417b2b2512b92 title: Extract Matches challengeType: 1 forumTopicId: 301340 localeTitle: Экстракционные матчи --- ## Description
До сих пор вы проверяли, существует ли шаблон в строке или нет. Вы также можете извлечь фактические совпадения, найденные с помощью .match() . Чтобы использовать метод .match() , примените метод к строке и передайте в регулярное выражение внутри круглых скобок. Вот пример:
«Hello, World!». Match (/ Hello /);
// Возвращает ["Hello"]
let ourStr = "Регулярные выражения";
пусть нашRegex = / выражения /;
ourStr.match (ourRegex);
// Возвращает ["выражения"]
## Instructions
Нанести .match() метод , чтобы извлечь слово coding .
## Tests
```yml tests: - text: The result should have the word coding testString: assert(result.join() === "coding"); - text: Your regex codingRegex should search for coding testString: assert(codingRegex.source === "coding"); - text: You should use the .match() method. testString: assert(code.match(/\.match\(.*\)/)); ```
## Challenge Seed
```js let extractStr = "Extract the word 'coding' from this string."; let codingRegex = /change/; // Change this line let result = extractStr; // Change this line ```
## Solution
```js let extractStr = "Extract the word 'coding' from this string."; let codingRegex = /coding/; // Change this line let result = extractStr.match(codingRegex); // Change this line ```