Reports empty lookahead and lookbehind assertions in regular expressions.
✅ This rule is included in the ts logical and logicalStrict presets.
Reports empty lookahead and lookbehind assertions in regular expressions.
Empty lookarounds like (?=) or (?!) will trivially accept or reject all inputs since they match the empty string.
AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">8 =sp>1<1/sp ansty="le--0:#5CA7E4;--1:#3A68">8F(?1/sp><=)sp ansty="le--0:#D9F5DD;--1:#1111">1=)sp><1/sp ansty="le--0:#D6DEEB;--1:#403F">51/sp><3;d ivclassNa="meco">;d>/;d>3;d> 44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">188F ><111/ spans="tyle--0:#5CA7E4;--1:#3A">688111/>616<88F) spans="tyle--0:#D9F5DD;--1:#11">188F)><111/ spans="tyle--0:#D6DEEB;--1:#40">3111/>
AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">8 =sp>1<1/sp ansty="le--0:#5CA7E4;--1:#3A68">8F(?1/sp>1!)sp><1/sp ansty="le--0:#D6DEEB;--1:#403F">51/sp><3;d ivclassNa="meco">;d>/;d>3;d> 44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">188F ><111/ spans="tyle--0:#5CA7E4;--1:#3A">688111/>616<88F) spans="tyle--0:#D9F5DD;--1:#11">188F)><111/ spans="tyle--0:#D6DEEB;--1:#40">3111/>
AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">8 =sp>1<1/sp ansty="le--0:#5CA7E4;--1:#3A68">8F(?<1/sp><=)sp ansty="le--0:#D9F5DD;--1:#1111">1=)sp><1/sp ansty="le--0:#D6DEEB;--1:#403F">51/sp><3;d ivclassNa="meco">;d>/;d>3;d> 44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">188F ><111/ spans="tyle--0:#5CA7E4;--1:#3A">688F111/><(?<= spans="tyle--0:#82AAFF;--1:#3B">61(?<=>6<88F) spans="tyle--0:#D9F5DD;--1:#11">188F)><111/ spans="tyle--0:#D6DEEB;--1:#40">3111/>
AEconsB0patteAE< =sp ansty="le--0:#5CA7E4;--1:#3A68">8 =sp>1<1/sp ansty="le--0:#5CA7E4;--1:#3A68">8F(?1/sp><=asp ansty="le--0:#7FDBCA;--1:#096E">7=asp><2?sp ansty="le--0:#5CA7E4;--1:#3A68">82?sp>1<1/sp ansty="le--0:#D6DEEB;--1:#403F">51/sp><3;d ivclassNa="meco">;d>/;d>3;d> 44AEco61B0pat446<88F spans="tyle--0:#D9F5DD;--1:#11">188F ><111/ spans="tyle--0:#5CA7E4;--1:#3A">688F111/><(?=a spans="tyle--0:#7FDBCA;--1:#09">6(?=a>6<88F) spans="tyle--0:#D9F5DD;--1:#11">188F)><111/ spans="tyle--0:#D6DEEB;--1:#40">3111/><+)/>+)/>
This rule is not configurable.
If you have a legitimate use case for empty lookarounds in generated or experimental regex patterns, you may disable this rule.