This is a discussion on how to replace emails & links in a string ? within the alt.comp.lang.php forums, part of the PHP Programming Forums category; hi, i want to remove emails & links strings in a string, replacing them with **** for instance. I don't ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
hi,
i want to remove emails & links strings in a string, replacing them with **** for instance. I don't know how to do with regexp...could you help me ? ex : source text : "hello, write to zozo@zozo.com and look http://toto.zozo.com !!" i wantr : "hello, write to ************* and look ******************** !!" thanks for any help ! fred |
|
|||
|
$sText = "hello, write to zozo@zozo.com and look http://toto.zozo.com !!";
$sMask = preg_replace('/((http:\\/\\/)?[-_a-z0-9]+([@\\.][-_a-z0-9]+)+)/ie', 'str_repeat("*", strLen("\\1"))', $sText); print $sMask; Bryan "Fred" <frederes@free.fr> wrote in message news:buttsb$ol7$1@news-reader5.wanadoo.fr... > hi, > > i want to remove emails & links strings in a string, replacing them with > **** for instance. > I don't know how to do with regexp...could you help me ? > > ex : > source text : "hello, write to zozo@zozo.com and look http://toto.zozo.com > !!" > i wantr : "hello, write to ************* and look ******************** !!" > > thanks for any help ! > > fred > > |
![]() |
| Thread Tools | |
| Display Modes | |
|
|