--- id: 587d7db4367417b2b2512b92 title: Extract Matches challengeType: 1 --- ## Description
So far, you have only been checking if a pattern exists or not within a string. You can also extract the actual matches you found with the .match() method. To use the .match() method, apply the method on a string and pass in the regex inside the parentheses. Here's an example:
"Hello, World!".match(/Hello/);
// Returns ["Hello"]
let ourStr = "Regular expressions";
let ourRegex = /expressions/;
ourStr.match(ourRegex);
// Returns ["expressions"]
## Instructions
Apply the .match() method to extract the word coding.
## Tests
```yml tests: - text: The result should have the word coding testString: 'assert(result.join() === "coding", "The result should have the word coding");' - text: Your regex codingRegex should search for coding testString: 'assert(codingRegex.source === "coding", "Your regex codingRegex should search for coding");' - text: You should use the .match() method. testString: 'assert(code.match(/\.match\(.*\)/), "You should use the .match() method.");' ```
## 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 // solution required ```