Re: Regular Expression

From: Date: Wed, 18 Apr 2001 15:09:44 +0000
Subject: Re: Regular Expression
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-49230@lists.php.net to get a copy of this message
On Wednesday 18 April 2001 17:07, you wrote: > On Wednesday 18 April 2001 13:39, you wrote: > > I have this text: > > > > "[ this is atest ] and this is the rest of the text" > > > > I want to get the text inbetween the [ and ]. > > if (preg_match ('/\[([^\]])\]/', $Subject, $Matches)) { > echo "Found it : '" . $Matches [1] . "'"; > } Ooops. The expression should read '/\[([^\]]+)\]/' -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Even idiots can handle computers, and many do.

« previous php.general (#49230) next »