Files

34 lines
645 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Extract Matches
---
# Extract Matches
2018-10-12 15:37:13 -04:00
---
## Problem Explanation
2018-10-12 15:37:13 -04:00
Using the `match()` method, you can extract parts of a string that match with your regular expression. In this challenge, you are extracting the word "coding" from the string provided.
---
## Hints
### Hint 1
2018-10-12 15:37:13 -04:00
Change your regex to detect the word "coding".
### Hint 2
2018-10-12 15:37:13 -04:00
Did you call the `match()` method on the string?
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
2018-10-12 15:37:13 -04:00
```javascript
let extractStr = "Extract the word 'coding' from this string.";
let codingRegex = /coding/;
let result = extractStr.match(codingRegex);
2018-10-12 15:37:13 -04:00
```
</details>