RE2 offers a couple of lesser known features for matching multiple regular expressions. Given that internal/README.md describes a "snippet index", which sounds remarkably like FilteredRE2, you might want to consider switching to FilteredRE2 and deleting the "snippet index" code.