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] . "'";
}
looks a bit perverse (because the [] brackets have special meaning in
regular expressions), but you'll get used to it :)
Also have a look at the description of the perl regex syntax in the manual
--
Christian Reiniger
LGDC Webmaster (http://sunsite.dk/lgdc/)
Even idiots can handle computers, and many do.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]