I'm trying to strip all characters from a string from a string except:
- Alphanumeric characters
- Dollar sign (
$
) - Underscore (
_
) - Unicode characters between code points
U+0080
andU+FFFF
I've got the first three conditions by doing this:
preg_replace('/[^a-zA-Z\d$_]+/', '', $foo);
How do I go about matching the fourth condition? I looked at using \X
but there has to be a better way than listing out 65000+ characters.