Remove all non-matching characters in PHP string?

Viewed 10144

I've got text from which I want to remove all characters that ARE NOT the following.

desired_characters =

0123456789!&',-./abcdefghijklmnopqrstuvwxyz\n

The last is a \n (newline) that I do want to keep.

2 Answers
Related