Re: preg_replace("/^\//".. doesnt work?

From: Date: Wed, 20 Feb 2002 19:59:43 +0000
Subject: Re: preg_replace("/^\//".. doesnt work?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-85576@lists.php.net to get a copy of this message
try: $a = preg_replace("/^\//", "", $a); On Wednesday 20 February 2002 12:25 pm, you wrote: > Im having a weird regexp problem in PHP that I think is correct but it > doesnt appear to work. > > The code is this: > > $a = "/test/"; > preg_replace("/^\//", "", $a); > echo $a; > > I want preg_replace to replace the first '/' in $a with '' so that the > echo function echoes "test/", but instead it echoes "/test/" as if > preg_replace didnt worked? What am I doing wrong? > > Im using: > PHP Version 4.1.1 > Configure Command: './configure' '--with-mysql=/usr/local/mysql' > '--with-apxs=/usr/local/apache/bin/apxs' '--with-db2--disable-debug' > '--disable-static' '--enable-sockets' '--with-yp' > '--with-zlib' > Regex Library: Bundled library enabled > PCRE (Perl Compatible Regular Expressions) Support: enabled > PCRE Library Version: 3.4 22-Aug-2000 > > > Please CC me since Im not a member of this maillinglist.

« previous php.general (#85576) next »