fix if regexp contains backslash
splitted up in functions