Files

33 lines
941 B
Markdown
Raw Normal View History

2018-10-12 15:37:13 -04:00
---
title: Match Single Character with Multiple Possibilities
---
# Match Single Character with Multiple Possibilities
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 vowels "a, e, i, o, u" from a provided string.
---
## Hints
### Hint 1
2018-10-12 15:37:13 -04:00
Are you attempting to use the test() method? Remember this method only returns True or False -- we need to extract the vowels from the string.
### Hint 2
2018-10-12 15:37:13 -04:00
Have you tried using the '[]' character case match without commas? i.e. [abcd] vs [a, b, c, d]
---
## Solutions
<details><summary>Solution 1 (Click to Show/Hide)</summary>
2018-10-12 15:37:13 -04:00
```javascript
let quoteSample =
"Beware of bugs in the above code; I have only proved it correct, not tried it.";
let vowelRegex = /[aeiou]/gi; // Change this line
2018-10-12 15:37:13 -04:00
let result = quoteSample.match(vowelRegex); // Change this line
```
</details>