"A"
, "B"
和"C"
。小写的示例是"a"
, "b"
和"c"
。您可以使用所谓的标志来匹配这两种情况。还有其他标志,但在这里你将专注于忽略大小写的标志 - i
旗帜。您可以通过将其附加到正则表达式来使用它。使用此标志的示例是/ignorecase/i
。此正则表达式可以匹配字符串"ignorecase"
, "igNoreCase"
和"IgnoreCase"
。 fccRegex
来匹配"freeCodeCamp"
,无论它的情况如何。您的正则表达式不应与任何缩写或带有空格的变体匹配。 freeCodeCamp
匹配
testString: 'assert(fccRegex.test("freeCodeCamp"), "Your regex should match freeCodeCamp
");'
- text: 你的正则表达式应该与FreeCodeCamp
匹配
testString: 'assert(fccRegex.test("FreeCodeCamp"), "Your regex should match FreeCodeCamp
");'
- text: 你的正则表达式应该与FreecodeCamp
匹配
testString: 'assert(fccRegex.test("FreecodeCamp"), "Your regex should match FreecodeCamp
");'
- text: 你的正则表达式应该与FreeCodecamp
匹配
testString: 'assert(fccRegex.test("FreeCodecamp"), "Your regex should match FreeCodecamp
");'
- text: 你的正则表达式不应该与Free Code Camp
不匹配
testString: 'assert(!fccRegex.test("Free Code Camp"), "Your regex should not match Free Code Camp
");'
- text: 你的正则表达式应该与FreeCOdeCamp
匹配
testString: 'assert(fccRegex.test("FreeCOdeCamp"), "Your regex should match FreeCOdeCamp
");'
- text: 你的正则表达式不应该与FCC
匹配
testString: 'assert(!fccRegex.test("FCC"), "Your regex should not match FCC
");'
- text: 你的正则表达式应该与FrEeCoDeCamp
匹配
testString: 'assert(fccRegex.test("FrEeCoDeCamp"), "Your regex should match FrEeCoDeCamp
");'
- text: 你的正则表达式应该与FrEeCodECamp
匹配
testString: 'assert(fccRegex.test("FrEeCodECamp"), "Your regex should match FrEeCodECamp
");'
- text: 你的正则表达式应该与FReeCodeCAmp
匹配
testString: 'assert(fccRegex.test("FReeCodeCAmp"), "Your regex should match FReeCodeCAmp
");'
```