* fix(curriculum): tests quotes * fix(curriculum): fill seed-teardown * fix(curriculum): fix tests and remove unneeded seed-teardown
1.9 KiB
1.9 KiB
id, title, challengeType
id | title | challengeType |
---|---|---|
587d7db5367417b2b2512b97 | Match Numbers and Letters of the Alphabet | 1 |
Description
-
) to match a range of characters is not limited to letters. It also works to match a range of numbers.
For example, /[0-5]/
matches any number between 0
and 5
, including the 0
and 5
.
Also, it is possible to combine a range of letters and numbers in a single character set.
let jennyStr = "Jenny8675309";
let myRegex = /[a-z0-9]/ig;
// matches all letters and numbers in jennyStr
jennyStr.match(myRegex);
Instructions
h
and s
, and a range of numbers between 2
and 6
. Remember to include the appropriate flags in the regex.
Tests
tests:
- text: Your regex <code>myRegex</code> should match 17 items.
testString: assert(result.length == 17, 'Your regex <code>myRegex</code> should match 17 items.');
- text: Your regex <code>myRegex</code> should use the global flag.
testString: assert(myRegex.flags.match(/g/).length == 1, 'Your regex <code>myRegex</code> should use the global flag.');
- text: Your regex <code>myRegex</code> should use the case insensitive flag.
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