1

I've a question similar this question: php preg_replace

In that question, He/She want to allow only letters and numbers and _, but I want to allow only numbers, letters and Unicode (non-latin) letters and numbers (I think, I should use the Unicode values of this (for example U+1F70)).

What can I do? Thanks ...

1 Answer 1

2

Instead of listing the unicode ranges yourself, you should use an Unicode character class as explained here: http://www.regular-expressions.info/unicode.html#block

preg_replace('/[^\w\d\p{L}]/u', "", $str);

If you repeatedly try to construct or decipher regexps, don't forget to check out Is there anything like RegexBuddy in the open source world? for utilities that help with that.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.