add: stub for regexp challenge - check for all or none (#31670)
This commit is contained in:
committed by
Randell Dawson
parent
844f4ec699
commit
9ebc54e9d5
@ -3,11 +3,17 @@ title: Check for All or None
|
||||
---
|
||||
## Check for All or None
|
||||
|
||||
With Regular Expressions (RegExp) you can have modify your testing pattern with special charaters. To pass this challenge you the __quantifiers__ are very helpful. A quantifier is __?__ in __x?__.
|
||||
|
||||
### Hint:
|
||||
The difference between american and british English for the given word is: favorite-favourite. We need to define the existance of the letter u .
|
||||
__x?__ Matches the preceding item x 0 or 1 time.
|
||||
|
||||
For example, /e?le?/ matches the "el" in "angel" and the "le" in "angle."
|
||||
|
||||
If used immediately after any of the quantifiers *, +, ?, or {}, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).
|
||||
|
||||
|
||||
__Challenge Solution:__
|
||||
|
||||
## Solution
|
||||
```javascript
|
||||
let favWord = "favorite";
|
||||
let favRegex = /favou?rite/; // Change this line
|
||||
|
Reference in New Issue
Block a user