Valid characters include the alphabet (abcd..), numbers (0123456789), spaces, ‘ and “.
I need to strip any other characters than these from a string in PHP.
Thanks 🙂
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You can do this:
Here the character class
[^a-z0-9 "']will match any character except the listed ones (note the inverting^at the begin of the character class) that are then replaced by an empty string.