* 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>
1.5 KiB
1.5 KiB
id, title, challengeType, forumTopicId, dashedName
id | title | challengeType | forumTopicId | dashedName |
---|---|---|---|---|
587d7db5367417b2b2512b97 | 匹配字母表中的数字和字母 | 1 | 301356 | match-numbers-and-letters-of-the-alphabet |
--description--
使用连字符(-
)匹配字符范围并不仅限于字母。它还可以匹配一系列数字。
例如,/[0-5]/
匹配0
和5
之间的任意数字,包含0
和5
。
此外,还可以在单个字符集中组合一系列字母和数字。
let jennyStr = "Jenny8675309";
let myRegex = /[a-z0-9]/ig;
// matches all letters and numbers in jennyStr
jennyStr.match(myRegex);
--instructions--
创建一个正则表达式,使其可以匹配h
和s
之间的一系列字母,以及2
和6
之间的一系列数字。请记得在正则表达式中包含恰当的标志。
--hints--
你的正则表达式myRegex
应该匹配 17 项。
assert(result.length == 17);
你的正则表达式myRegex
应该使用全局标志。
assert(myRegex.flags.match(/g/).length == 1);
你的正则表达式myRegex
应该使用忽略大小写的标志。
assert(myRegex.flags.match(/i/).length == 1);
--seed--
--seed-contents--
let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line
--solutions--
let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /[h-s2-6]/gi; // Change this line
let result = quoteSample.match(myRegex); // Change this line