Last updated on November 17th, 2015 at 05:09 am

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Non-Alpha numeric characters are any which is not A-Z,a-z or 0-9

A classic example of Non-Alphanumeric characters are !ӣ$%^&*(), Here we will see how to remove Non-Alphanumeric characters using php.


< ?php
$str = "Here! are some numbers 1244 and some non alphanumeric characters !£$%^&";
$new_string = preg_replace("/[^a-zA-Z0-9\s]/", "", $str);
echo $new_string;

This is a very simple script which remove ! and other characters from the string !£$%^&

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)

Leave a Reply

Your email address will not be published. Required fields are marked *