Add tests for expanded vs compiled regexes and foreach