frequently ask ? : Computers : Programming : Languages : PHP : Common Problems : Regular Expressions

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

41 of 42 people (98%) answered Yes
Recently 10 of 10 people (100%) answered Yes

Entry

How can I remove *every* character accept letters and numbers from a string?

Aug 24th, 2000 21:12
Ben Udall, Tim Johnson,


Try this, it should remove every character that's not a letter or 
number.
$new_data = ereg_replace("[^A-Za-z0-9]", "", $data);