Re: Stripping characters.....
| From: | CC Zona | Date: | Sun, 28 Apr 2002 06:39:41 +0000 |
| Subject: | Re: Stripping characters..... | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94967@lists.php.net to get a copy of this message | ||
In article <email-871525.23331427042002@pb1.pair.com>,
email@cczona.com (Cc Zona) wrote:
> In article <5.1.0.14.2.20020428011219.02071998@redhotsweeps.com>,
> mail@redhotsweeps.com (Cditty) wrote:
>
> > ie....User email address is "Chris Ditty"
> > <mail@redhotsweeps.com> or Chris Ditty <mail@redhotsweeps.com>
> >
> > I need to be able to strip the quotes and everything between them and the
> > < > signs from the first one and then the name and the < > signs from the
> > second.
> >
> > Does anyone know how to do this quickly and easily?
>
> <http://php.net/preg-replace>. For example:
>
> preg_replace('/^.*<(.+)>.*$/',"$1",$mailstring);
Whoops. Hit send too quickly. That should be:
$newstring=preg_replace('/^.*<(.+)>.*$/',"$1",$mailstring);
Note that this is *just* an example. It will break where there are
multiple addressees, a less-than sign in the addressee's name, etc.
--
CC