Regex is r'[A-z\d,\-.\ \/\n]{1,}', This regex will allow alphanumeric + some special chars.
I want to replace characters which are not allowed.
I have tried,
re.sub(r'[A-z\d,\-.\ \/\n]{1,}', ' ', 'ASGHB 3 JHDSD eyg && ^&*hdbcd v%^&*B#$%^')
Gives output as,
' && &* % &* #$% '
I want original string as output with replaced special chars (which are not allowed) with white spaces.
Expected output : ASGHB 3 JHDSD eyg ^ hdbcd v ^ B ^
How to achieve this ?
re.sub(r'[^A-z\d,\-.\ \/\n]{1,}', ' ', 'ASGHB 3 JHDSD eyg && ^&*hdbcd v%^&*B#$%^')=>'ASGHB 3 JHDSD eyg ^ hdbcd v ^ B ^'? You should give your expected result.[A-z]until or otherwise you know what it actually does.