I am having trouble in finding the way to create a proper regex that replaces in a string anything different from a-z, A-Z, 0-9 and |.
Until now, I have:
re.sub(r'[\W_]+', '', s)
This works fine for alphanumerical characters, but I also need to make it work for pipe ("|"). Does anyone know how to make it?
For example, if I have:
name&|surna.me|ag,e
I need it like:
name|surname|age