Regex implementation that supports lookahead and lookbehind

It would be nice to have a regex implementation in Pi-Hole that supports lookahead and lookbehind assertions. An example is the following regex:


This regex, unfortunately, also matches ‘’ which is necessary for the admin panel. Having a negative lookahead of (ad(?!min)) would be handy here, it would still match strings with ‘ad’ but not ‘admin’. There are other situations with positive or negative lookahead or lookbehind would be handy.

Another handy side-effect of this would be the inclusion of non-capturing groups, which would help reduce memory footprint a fraction, as matched groups wouldn’t be kept in memory during evaluation.

This would also allow easier building of more complex regex strings, which could potentially help keep the number of needed strings down. I know there’s a bit of a limit to the number of expressions, so this could help mitigate that by being able to more easily merge multiple expressions together.