PHP: Remove Everything But Letters And Numbers – Reg Expressions


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. $string = "remove ever^&thing but *&^*&%£ letters & numbers*&^*";
  2. $cleansedstring = ereg_replace("[^A-Za-z0-9]", "", $string );
  3. echo $cleansedstring;

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.