2018-10-10 18:03:03 -04:00
---
id: 587d7db6367417b2b2512b98
2021-02-06 04:42:36 +00:00
title: Match Single Characters Not Specified
2018-10-10 18:03:03 -04:00
challengeType: 1
2020-08-04 15:14:01 +08:00
forumTopicId: 301358
2021-01-13 03:31:00 +01:00
dashedName: match-single-characters-not-specified
2018-10-10 18:03:03 -04:00
---
2020-12-16 00:37:30 -07:00
# --description--
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
So far, you have created a set of characters that you want to match, but you could also create a set of characters that you do not want to match. These types of character sets are called < dfn > negated character sets< / dfn > .
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
To create a negated character set, you place a caret character (`^` ) after the opening bracket and before the characters you do not want to match.
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
For example, `/[^aeiou]/gi` matches all characters that are not a vowel. Note that characters like `.` , `!` , `[` , `@` , `/` and white space are matched - the negated vowel character set only excludes the vowel characters.
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
# --instructions--
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
Create a single regex that matches all characters that are not a number or a vowel. Remember to include the appropriate flags in the regex.
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
# --hints--
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
Your regex `myRegex` should match 9 items.
2018-10-10 18:03:03 -04:00
```js
2020-12-16 00:37:30 -07:00
assert(result.length == 9);
2018-10-10 18:03:03 -04:00
```
2021-02-06 04:42:36 +00:00
Your regex `myRegex` should use the global flag.
2018-10-10 18:03:03 -04:00
2020-12-16 00:37:30 -07:00
```js
assert(myRegex.flags.match(/g/).length == 1);
```
2018-10-10 18:03:03 -04:00
2021-02-06 04:42:36 +00:00
Your regex `myRegex` should use the case insensitive flag.
2018-10-10 18:03:03 -04:00
```js
2020-12-16 00:37:30 -07:00
assert(myRegex.flags.match(/i/).length == 1);
2018-10-10 18:03:03 -04:00
```
2020-08-04 15:14:01 +08:00
2021-01-13 03:31:00 +01:00
# --seed--
## --seed-contents--
```js
let quoteSample = "3 blind mice.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line
```
2020-12-16 00:37:30 -07:00
# --solutions--
2021-01-13 03:31:00 +01:00
```js
let quoteSample = "3 blind mice.";
let myRegex = /[^0-9aeiou]/gi; // Change this line
let result = quoteSample.match(myRegex); // Change this line
```