A port of CommonRegex