Skip to content
Advertisement

Detect emoticons in string

I found that you need PHP 7 and MySQL 5.5 to use emoticons in a string that you want to upload to the database. I don’t have these specification on my server so I want to give an error message in laravel or php.

Is there a way to detect emoticons in php? If so then I can create a custom validation or something like that?

I’ve tried alpha_dash validation in Laravel but then it isn’t possible to do one old-school like this one :-)

Advertisement

Answer

To follow on from Johannes answer I found a solution on a forum somewhere. This regex does the trick 🙂

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement