|
|
Remove non alphabet, non-numbers (alphanumeric) from string - PHP
|
Views : 928
|
|
Tagged in : PHP
|
|
|
Report This Scrap as Inappropriate We request you to choose the appropriate categroy and subcategory that suits your
objectionable concern about the scrap, So that our team can review and find out whether it violates our Guidelines or the
scrap is not suitable for all viewers.
|
Remove non alphabet, non-numbers (alphanumeric) from string (leaving white space)
Again ereg_replace will come to our help...
ereg_replace("[^A-Za-z0-9\s]", "", $string_to_be_stripped );
Example
$string_to_be_stripped = "NON alpha & numeric # string replace";
$new_string = ereg_replace("[^A-Za-z0-9\s]", "", $string_to_be_stripped );
echo $new_string;
?>
Result: "NON alpha numeric string replace";
if we don't want space too then we have to use [^A-Za-z0-9] instead of [^A-Za-z0-9\s] in ereg_replace..
|
|
By rajesh, On - 2010-01-03 |
|
|
|