2.6 KiB
2.6 KiB
id, title, challengeType, forumTopicId, localeTitle
id | title | challengeType | forumTopicId | localeTitle |
---|---|---|---|---|
587d7db6367417b2b2512b98 | Match Single Characters Not Specified | 1 | 301358 | Совпадение отдельных символов не указано |
Description
negated character sets
. Чтобы создать negated character set
, вы поместите символ caret
( ^
) после открывающей скобки и перед символами, которые вы не хотите сопоставлять. Например, /[^aeiou]/gi
соответствует всем символам, которые не являются гласным. Обратите внимание, что символы вроде .
, !
, [
, @
, /
и пробел совпадают - набор символов отрицательного гласного исключает только символы гласных.
Instructions
Tests
tests:
- text: Your regex <code>myRegex</code> should match 9 items.
testString: assert(result.length == 9);
- text: Your regex <code>myRegex</code> should use the global flag.
testString: assert(myRegex.flags.match(/g/).length == 1);
- text: Your regex <code>myRegex</code> should use the case insensitive flag.
testString: assert(myRegex.flags.match(/i/).length == 1);
Challenge Seed
let quoteSample = "3 blind mice.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line
Solution
let quoteSample = "3 blind mice.";
let myRegex = /[^0-9aeiou]/gi; // Change this line
let result = quoteSample.match(myRegex); // Change this line