Posted By

Wardy on 04/28/10


Tagged

php String text clean


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

dantreacy
colingardom
Priestd09


PHP: Remove Everything But Letters And Numbers – Reg Expressions


 / Published in: PHP
 

URL: http://www.brightcherry.co.uk/scribbles/2008/07/15/php-remove-everything-but-letters-and-numbers-reg-expressions/

  1. $string = "remove ever^&thing but *&^*&%£ letters & numbers*&^*";
  2. $cleansedstring = ereg_replace("[^A-Za-z0-9]", "", $string );
  3. echo $cleansedstring;

Report this snippet  

You need to login to post a comment.