Function to hide sloppy phone numbers..
- by Frank Malina
I need to hide phone numbers (and maybe other contact details) in user generated content to protect my users from anonymous web. Input is very random, therefore
I'd be looking to replace anything that looks like a phone number (e.g.: string of 3 or more numbers) with just dots, and also perhaps remove some exotic notations of e-mail addresses.
What is the best way to do this? Nice and slick, reusable. Give away your secret regexes. Write in any language. Except perhaps COBOL :)
function privacy($str){
// protect phone numbers
// protect e-mail addresses
// protect web addresses
}