Re: Remove punctuation
| From: | Jason Davidson | Date: | Thu, 09 Sep 2004 18:57:34 +0000 |
| Subject: | Re: Remove punctuation | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-196241@lists.php.net to get a copy of this message | ||
i think str_replace is faster that ereg_replace
Jason
John Nichel <john@kegworks.com> wrote:
>
> Jed R. Brubaker wrote:
> > Hi all!
> >
> > I am creating a function that will remove punctuation from a string,
> > however, I am wondering if PHP has a function somewhere that will do the
> > same.
> >
> > Right now my approach is to cycle through an array of punctuation and remove
> > the items.
> >
> > Anything already exist?
> >
> > Thanks!
> >
>
> You don't have to cycle through an array...
>
> preg_replace ( "/[\.,\";'\:]/", "", $string )
>
> --
> John C. Nichel
> ÜberGeek
> KegWorks.com
> 716.856.9675
> john@kegworks.com
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>