This is a discussion on [newb] preg_replace for an email string within the PHP Language forums, part of the PHP Programming Forums category; hi, while i'm not new to php, i'm new to pattern matching and am finding it rather difficult .. ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
hi, while i'm not new to php, i'm new to pattern matching and am finding it rather difficult .. i would like to take a string that's an email address, and change the '@' with '(at)' and any '.'s with '(dot)'. so for instance, email@nospam.com.au would become email(at)nospam(dot)com(dot)au. many thanks for any pointers luke |
|
|||
|
One quick glance of an experienced eye allowed to understand the blurred
and almost unreadable luke's handwriting: > > hi, > > while i'm not new to php, i'm new to pattern matching and am finding it > rather difficult .. i would like to take a string that's an email > address, and change the '@' with '(at)' and any '.'s with '(dot)'. so > for instance, email@nospam.com.au would become > email(at)nospam(dot)com(dot)au. > > many thanks for any pointers > luke Why use preg_replace? It's like firing a cannon on a mosquito. I'd recommend str_replace - refer to www.php.net for documentation. It will do exactly what you need. Cheers Mike |
|
|||
|
"Micha³ Wo¼niak" <mikiwoz_remove_this@yahoo_remove_this.co.uk> wrote in message news:d4kn37$5q0$1@213-238-73-81.adsl.inetia.pl... > One quick glance of an experienced eye allowed to understand the blurred > and almost unreadable luke's handwriting: > i like to keep my helpers on their toes. thanks for the tip. |
|
|||
|
ooh. now that's what i was looking for. many thanks marius! "spampop.10.zmalltalker@spamgourmet.com" <marius.mathiesen@gmail.com> wrote in message news:1114511956.918311.266300@z14g2000cwz.googlegr oups.com... > preg_replace(array("/@/","/\./"),array("(at)","(dot)"),"first.last@host.doma in.tld"); > > Have fun! > > Marius > |