Fix order of regular expression building. Found when running on OS X.