On Thu, August 2, 2007 9:43 am, Don Don wrote: > hi all, am trying to cut some texts from a serries of string values > e.g. > > "this is how we do (50 cents feat. the game)" > "give it to me (nelly feat timerland)" > "let me hold you (bow wow feat omarion)" > > i want to cut off the text between the comas and i've seen some > examples > > <? > $string = "Hello world, <b>this is a test</b>"; > preg_match('/<b>.*<\/b>/i', $string, $result); > echo strip_tags($result[0]); > ?> > > <? > $string = "Hello world, <b>this is a test</b>"; > list($junk, $good) = split('<b>', $string); > list($good, $junk) = split('</b>', $good); > echo $good; > ?> > > but they wont work with comas Those are not comas, or even commas, but parentheses. Parentheses have a specific meaning in PCRE. http://php.net/pcre If you want a literal parenthesis in your pattern, you need to escape it. Try this: preg_match('|^(.*)\\((.*)\\)$', $string, $parts); echo "<pre>"; var_dump($parts); echo "</pre>"; -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some indie artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php