Regex Help with -> ?
| From: | Gerard Samuel | Date: | Thu, 26 Jun 2003 19:26:01 +0000 |
| Subject: | Regex Help with -> ? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-153016@lists.php.net to get a copy of this message | ||
I have a string something like ->
<[TIT2]> ABC <[TPE1]> GHI <[TALB]> XYZ
Im applying a regex as such ->
// Title/Songname/Content
preg_match('/<\[TIT2\]>(.*?)(<\[)?/', $foo, $match);
$title = trim( $match[1] );
The above regex doesn't work. At the end of the pattern Im using (<\[)?
The pattern may or may not end with <[
For example searching for -> <[TALB]> XYZ
The string, is *NOT* expected to hold a certain order as how it is retrieved.
How does one go about to fix up this regex?
Thanks