Skip to content

regexIgnoreCaseFlags

Reports regex patterns that can be simplified by using the i (ignore case) flag.

✅ This rule is included in the ts logical and logicalStrict presets.

When a character class contains both upper and lower case versions of the same letters, the pattern can be simplified by using the i (ignore case) flag. This makes the regex shorter and clearer by eliminating redundant character class entries.

AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">81<1/sp ansty="le--0:#82AAFF;--1:#3B61">B0[a1<1/sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco">AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">81<1/sp ansty="le--0:#82AAFF;--1:#3B61">B0[a-zA-1<1/sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco">AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">81<1/sp ansty="le--0:#82AAFF;--1:#3B61">B0[aAbBc1<1/sp ansty="le--0:#D6DEEB;--1:#403F">5<3;d ivclassNa="meco">
44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#82AAFF;--1:#3B">61B<0[a] spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#5CA7E4;--1:#3A">6<88Fi spans="tyle--0:#D6DEEB;--1:#40">3<]/i><;di vdivclass="Nameexpressive-">44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#82AAFF;--1:#3B">61B0[1<111/ spans="tyle--0:#5CA7E4;--1:#3A">6<88Fi spans="tyle--0:#D6DEEB;--1:#40">3<]/i><;di vdivclass="Nameexpressive-">44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#82AAFF;--1:#3B">61B0[1<111/ spans="tyle--0:#5CA7E4;--1:#3A">6<88Fi spans="tyle--0:#D6DEEB;--1:#40">3<]/i><;di vdivclass="Nameexpressive-">6376// Only lowercase letters - no redund44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#82AAFF;--1:#3B">61B0[1<111/ spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">6376// Only uppercase letters - no redund44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#82AAFF;--1:#3B">61B0[1<111/ spans="tyle--0:#D6DEEB;--1:#40">3<;di vdivclass="Nameexpressive-">6376// Already using the i 44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">1<111/ spans="tyle--0:#82AAFF;--1:#3B">61B0[1<111/ spans="tyle--0:#5CA7E4;--1:#3A">6<88Fi spans="tyle--0:#D6DEEB;--1:#40">3<]/i>

This rule is not configurable.

If you need explicit control over case matching in your regex patterns, or if your codebase intentionally avoids the i flag for performance or compatibility reasons, you might prefer to disable this rule. Some legacy JavaScript environments may have inconsistent behavior with the i flag for non-ASCII characters.