2.7 KiB
2.7 KiB
id, title, challengeType, forumTopicId
id | title | challengeType | forumTopicId |
---|---|---|---|
587d7db4367417b2b2512b91 | Ignore Case While Matching | 1 | 301344 |
Description
"A"
, "B"
, and "C"
. Examples of lowercase are "a"
, "b"
, and "c"
.
You can match both cases using what is called a flag. There are other flags but here you'll focus on the flag that ignores case - the i
flag. You can use it by appending it to the regex. An example of using this flag is /ignorecase/i
. This regex can match the strings "ignorecase"
, "igNoreCase"
, and "IgnoreCase"
.
Instructions
fccRegex
to match "freeCodeCamp"
, no matter its case. Your regex should not match any abbreviations or variations with spaces.
Tests
tests:
- text: Your regex should match <code>freeCodeCamp</code>
testString: assert(fccRegex.test('freeCodeCamp'));
- text: Your regex should match <code>FreeCodeCamp</code>
testString: assert(fccRegex.test('FreeCodeCamp'));
- text: Your regex should match <code>FreecodeCamp</code>
testString: assert(fccRegex.test('FreecodeCamp'));
- text: Your regex should match <code>FreeCodecamp</code>
testString: assert(fccRegex.test('FreeCodecamp'));
- text: Your regex should not match <code>Free Code Camp</code>
testString: assert(!fccRegex.test('Free Code Camp'));
- text: Your regex should match <code>FreeCOdeCamp</code>
testString: assert(fccRegex.test('FreeCOdeCamp'));
- text: Your regex should not match <code>FCC</code>
testString: assert(!fccRegex.test('FCC'));
- text: Your regex should match <code>FrEeCoDeCamp</code>
testString: assert(fccRegex.test('FrEeCoDeCamp'));
- text: Your regex should match <code>FrEeCodECamp</code>
testString: assert(fccRegex.test('FrEeCodECamp'));
- text: Your regex should match <code>FReeCodeCAmp</code>
testString: assert(fccRegex.test('FReeCodeCAmp'));
Challenge Seed
let myString = "freeCodeCamp";
let fccRegex = /change/; // Change this line
let result = fccRegex.test(myString);
Solution
let myString = "freeCodeCamp";
let fccRegex = /freecodecamp/i; // Change this line
let result = fccRegex.test(myString);