1.9 KiB
1.9 KiB
id, title, challengeType, videoUrl, localeTitle
id | title | challengeType | videoUrl | localeTitle |
---|---|---|---|---|
587d7db5367417b2b2512b97 | Match Numbers and Letters of the Alphabet | 1 | 匹配数字和字母的字母 |
Description
-
)匹配一系列字符不仅限于字母。它也适用于匹配一系列数字。例如, /[0-5]/
匹配0
到5
之间的任何数字,包括0
和5
。此外,可以在单个字符集中组合一系列字母和数字。 让jennyStr =“Jenny8675309”;
让myRegex = / [a-z0-9] / ig;
//匹配jennyStr中的所有字母和数字
jennyStr.match(myRegex);
Instructions
h
和s
之间的字母范围匹配的正则表达式,以及介于2
和6
之间的数字范围。请记住在正则表达式中包含适当的标志。 Tests
tests:
- text: 你的正则表达式<code>myRegex</code>应该匹配17项。
testString: 'assert(result.length == 17, "Your regex <code>myRegex</code> should match 17 items.");'
- text: 你的正则表达式<code>myRegex</code>应该使用全局标志。
testString: 'assert(myRegex.flags.match(/g/).length == 1, "Your regex <code>myRegex</code> should use the global flag.");'
- text: 你的正则表达式<code>myRegex</code>应该使用不区分大小写的标志。
testString: 'assert(myRegex.flags.match(/i/).length == 1, "Your regex <code>myRegex</code> should use the case insensitive flag.");'
Challenge Seed
let quoteSample = "Blueberry 3.141592653s are delicious.";
let myRegex = /change/; // Change this line
let result = myRegex; // Change this line
Solution
// solution required