Fix longstanding bug where invalid regular expressions would cause an exception, disallowing things like using the glob pattern '*' to match files