Fri, 17 May 2024


How to check for special symbols in the user input?

By: Nathalie, NetArt Media
Sat, 18 July 2020

You may use the following regular expression:
/^[a-zA-Z0-9_-+ t/@%.]+$/

For example:
return (preg_match('/^[a-zA-Z0-9_-+ t/@%.]+$/', $str);


Category: PHP Examples
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox