You want to use sub() , not search() :
>>> strs = 'dsds +48 124 cat cat cat245 81243!!' >>> re.sub(r"[^0-9+._ -]+", "", strs) ' +48 124 245 81243'
[^0-9+._ -] is a negative character class . The ^ sign is significant here - this expression means: "Match characters that are neither a number, nor a plus, a dot, an underscore, a space, or a dash."
+ tells the regex engine to match one or more instances of the previous token.
source share