.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:
```js
"Hello, World!".match(/Hello/);
// Returns ["Hello"]
let ourStr = "Regular expressions";
let ourRegex = /expressions/;
ourStr.match(ourRegex);
// Returns ["expressions"]
```
.match()
method to extract the word coding
.
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\(.*\)/));
```