Remove some characters from a string

Julien jphalip at
Thu Jul 17 10:13:21 CEST 2008


I can't seem to find the right regular expression to achieve what I
want. I'd like to remove all characters from a string that are not
numbers, letters or underscores.

For example:

>>> magic_function('si_98%u^d at .as-*gf')
str: 'si_98udasgf'

Would you have any hint?

Thanks a lot!


More information about the Python-list mailing list