feat(curriculum): add grouping characters challenge and guide (#34875)
Added new challenge for mixed grouping of characters
This commit is contained in:
committed by
Jaka Kranjc
parent
e1be160a65
commit
ca2d01a81c
@ -0,0 +1,24 @@
|
||||
---
|
||||
title: Check For Mixed Grouping of Characters
|
||||
---
|
||||
## Check For Mixed Grouping of Characters
|
||||
|
||||
### Hint 1
|
||||
|
||||
Use `a|b` to check for either `a` or `b`.
|
||||
|
||||
### Hint 2
|
||||
|
||||
Your regex should use mixed grouping like `/P(engu|umpk)in/g`.
|
||||
|
||||
### Hint 3
|
||||
|
||||
Use `.*` to allow for middle names.
|
||||
|
||||
### Solution
|
||||
|
||||
```javascript
|
||||
let myString = "Eleanor Roosevelt";
|
||||
let myRegex = /(Franklin|Eleanor).*Roosevelt/;
|
||||
let result = myRegex.test(myString);
|
||||
```
|
Reference in New Issue
Block a user