Re: New to php3 - pattern matching?

From: Date: Sat, 22 Jul 2000 09:46:26 +0000
Subject: Re: New to php3 - pattern matching?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-7676@lists.php.net to get a copy of this message
At 03:32 AM 7/21/00 -0400, Sterling Hughes wrote: >> have just installed php3 and mysql etc ... have used perl before >> >> if I have $item which has a "/" in it and I want to remove it - perl >> would be something like $item =~ s/\///; > >$item = preg_replace("/\//", "", $item); > >-Sterling Now I would have said: str_replace ("/", "", "$item"); Can anyone explain the benefit of using preg_replace over str_replace? The examples I see on this list always look so dang obfuscated :) Later, Jeff Gannaway

« previous php.general (#7676) next »