You should mark this string as a "raw" string, like `r'\+\++$'`, so that the interpreter doesn't get confused about the backslashes. Maybe it is smart enough to figure it out, but I don't know if I am :)