Skip to content
Advertisement

How can I restrict some special characters only in PHP?

I am using preg_match for restrict the special characters in form post. Now I need to restrict some special characters only like %,$,#,* and I need to post like . How to possible to restrict some special characters only.

My code:

JavaScript

Advertisement

Answer

You should use:

JavaScript

to match those characters.

So in preg_match you should use:

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