On 8/2/07, Dan Shirah <[EMAIL PROTECTED]> wrote:
> Maybe I'm blind, but I don't see any commas in the text you are referring
> to.
>
> On 8/2/07, Don Don <[EMAIL PROTECTED]> 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
> >
> >
> > ---------------------------------
> > Yahoo! oneSearch: Finally, mobile search that gives answers, not web
> > links.
>
To remove the text between the comas would be a great feat,
especially if you're still groggy from waking up from the first one.
However, if you meant "commas", then I, like the others, don't see
one.
On a different note, with all kidding aside now, if you want to
strip everything in parentheses, inclusively, then you can use this
code:
<?
$string[] = "this is how we do (50 cents feat. the game)";
$string[] = "give it to me (nelly feat timerland)";
$string[] = "let me hold you (bow wow feat omarion)";
foreach($string as $p => $v) {
$out = preg_replace('/\(.*\)/',null,$v);
echo $out."\n";
}
?>
--
Daniel P. Brown
[office] (570-) 587-7080 Ext. 272
[mobile] (570-) 766-8107
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php