The regex needs to be precompiled here, and if None is passed, the variable should not be set after you delete it.