regex optimizations in SquashImports