Function to hide sloppy phone numbers..

Posted by Frank Malina on Stack Overflow See other posts from Stack Overflow or by Frank Malina
Published on 2010-03-30T20:29:47Z Indexed on 2010/03/30 20:33 UTC
Read the original article Hit count: 405

Filed under:
|
|
|
|

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

}

© Stack Overflow or respective owner

Related posts about php

Related posts about python