I have user entries as filenames. Of course this is not a good idea, so I want to drop everything except [a-z]
, [A-Z]
, [0-9]
, _
and -
.
For instance:
my§document$is°° very&interesting___thisIs%nice445.doc.pdf
should become
my_document_is_____very_interesting___thisIs_nice445_doc.pdf
and then ideally
my_document_is_very_interesting_thisIs_nice445_doc.pdf
Is there a nice and elegant way for doing this?