Fix match single unspecified characters hint page (#34615)
This commit is contained in:
committed by
The Coding Aviator
parent
ff4afe4683
commit
b0c239ff53
@ -5,7 +5,7 @@ title: Match Single Characters Not Specified
|
|||||||
In this challenge, we are asked to return a collection of matches that are not exactly specified. Whereas previous regexp challenges would have you match within the character case [a-z], this challenge instead asks us to negate these matches using the caret character [^a-z]. Our goal then is to return a negated collection (non-matches) of letters that are not vowels nor numbers.
|
In this challenge, we are asked to return a collection of matches that are not exactly specified. Whereas previous regexp challenges would have you match within the character case [a-z], this challenge instead asks us to negate these matches using the caret character [^a-z]. Our goal then is to return a negated collection (non-matches) of letters that are not vowels nor numbers.
|
||||||
|
|
||||||
## Hint 1:
|
## Hint 1:
|
||||||
Did you remember to surround your regexp in both brackets and slashes?
|
Did you remember to surround your regexp in both brackets and slashes?
|
||||||
```javascript
|
```javascript
|
||||||
let exampleRegExp = /[^a-z]/;
|
let exampleRegExp = /[^a-z]/;
|
||||||
```
|
```
|
||||||
@ -15,9 +15,9 @@ If so, then double check you're adding the appropriate flags:
|
|||||||
* ^ : Negates the matches following this flag
|
* ^ : Negates the matches following this flag
|
||||||
|
|
||||||
### Hint 2:
|
### Hint 2:
|
||||||
Be sure to check whether your number range is correct -- the challenge asks us to negate all numbers from 0-99. This can be done using the negate caret placed immediately after the first opening bracket of your regexp.
|
Be sure to check whether your number range is correct -- the challenge asks us to negate all numbers from 0 to 9. This can be done using the negate caret placed immediately after the first opening bracket of your regexp.
|
||||||
```javacsript
|
```javacsript
|
||||||
let numbersRegExp = /[^0-99]/ig;
|
let numbersRegExp = /[^0-9]/ig;
|
||||||
```
|
```
|
||||||
|
|
||||||
### Spoiler Alert - Solution Ahead
|
### Spoiler Alert - Solution Ahead
|
||||||
@ -25,6 +25,6 @@ let numbersRegExp = /[^0-99]/ig;
|
|||||||
## Solution
|
## Solution
|
||||||
```javascript
|
```javascript
|
||||||
let quoteSample = "3 blind mice.";
|
let quoteSample = "3 blind mice.";
|
||||||
let myRegex = /[^aeiou^0-99]/ig; // Change this line
|
let myRegex = /[^aeiou^0-9]/ig; // Change this line
|
||||||
let result = quoteSample.match(myRegex); // Change this line
|
let result = quoteSample.match(myRegex); // Change this line
|
||||||
```
|
```
|
||||||
|
Reference in New Issue
Block a user