Re: Trimming text
| From: | liljim | Date: | Wed, 24 Apr 2002 08:41:50 +0000 |
| Subject: | Re: Trimming text | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94331@lists.php.net to get a copy of this message | ||
Hello Ashley,
<?
$string = trim($string);
$string = preg_replace("/<span class[^>]+>modified by.*?<\/span>\.$/is",
"",
$string);
// remove the \. if it doesn't end in a full
stop ^
?>
Try that.
James
"Ashley M. Kirchner" <ashley@pcraft.com> wrote in message
news:3CC65928.C7E5996@pcraft.com...
>
> I have a variable ($description) that contains text data (pulled from
an MySQL DB). I need to delete the last few lines from that data. Prior to
the data getting submitted to the DB (during a different routine), the
following information gets added:
>
> $description .= "\n\n< span class=gensmall >Modified by
".$userdata[username]."< /span >.";
> (spaces added so the tags don't get parsed)
>
> Later in the routine, that data gets pulled back up for modification
and I need to delete that last bit from it. From the starting '\n' till the
end '< /span >.'...
>
> What's the best, and or easiest way to do this?
>
> --
> H | "Life is the art of drawing without an eraser." - John Gardner
> +--------------------------------------------------------------------
> Ashley M. Kirchner <mailto:ashley@pcraft.com> .
> 303.442.6410 x130
> Director of Internet Operations / SysAdmin . 800.441.3873 x130
> Photo Craft Laboratories, Inc. . 3550 Arapahoe Ave, #6
> http://www.pcraft.com ..... . . . Boulder, CO
> 80303, U.S.A.
>
>