Oliver Eyton-Williams ee1e8abd87
feat(curriculum): restore seed + solution to Chinese (#40683)
* feat(tools): add seed/solution restore script

* chore(curriculum): remove empty sections' markers

* chore(curriculum): add seed + solution to Chinese

* chore: remove old formatter

* fix: update getChallenges

parse translated challenges separately, without reference to the source

* chore(curriculum): add dashedName to English

* chore(curriculum): add dashedName to Chinese

* refactor: remove unused challenge property 'name'

* fix: relax dashedName requirement

* fix: stray tag

Remove stray `pre` tag from challenge file.

Signed-off-by: nhcarrigan <nhcarrigan@gmail.com>

Co-authored-by: nhcarrigan <nhcarrigan@gmail.com>
2021-01-12 19:31:00 -07:00

1.5 KiB

id, title, challengeType, forumTopicId, dashedName
id title challengeType forumTopicId dashedName
587d7db6367417b2b2512b98 匹配单个未指定的字符 1 301358 match-single-characters-not-specified

--description--

到目前为止,已经创建了一个想要匹配的字符集合,但也可以创建一个不想匹配的字符集合。这些类型的字符集称为否定字符集

要创建否定字符集,需要在开始括号后面和不想匹配的字符前面放置插入字符(即^)。

例如,/[^aeiou]/gi匹配所有非元音字符。注意,字符.![@/和空白字符等也会被匹配,该否定字符集仅排除元音字符。

--instructions--

创建一个匹配所有非数字或元音字符的正则表达式。请记得在正则表达式中包含恰当的标志。

--hints--

你的正则表达式myRegex应该匹配 9 项。

assert(result.length == 9);

你的正则表达式myRegex应该使用全局标志。

assert(myRegex.flags.match(/g/).length == 1);

你的正则表达式myRegex应该使用忽略大小写标志。

assert(myRegex.flags.match(/i/).length == 1);

--seed--

--seed-contents--

let quoteSample = "3 blind mice.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line

--solutions--

let quoteSample = "3 blind mice.";
let myRegex = /[^0-9aeiou]/gi; // Change this line
let result = quoteSample.match(myRegex); // Change this line