looks like id3v2 ;-)

how about this:
$string = "<[TIT2]> ABC <[TPE1]> GHI <[TALB]> XYZ";
$pattern = "/<\[TIT2\]>([^<]*)/"; // matches anything exept '<'; till '<' or
end of string
preg_match($pattern, $string, $match);
var_export($match);

hint to your regex:
either use quantifier '*' (0-n times) OR '?' (0-1 times)

ciao SVEN

"Gerard Samuel" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
news:[EMAIL PROTECTED]
> 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
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to