Re: Trimming text
| From: | Miguel Cruz | Date: | Wed, 24 Apr 2002 15:19:12 +0000 |
| Subject: | Re: Trimming text | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-94393@lists.php.net to get a copy of this message | ||
On Wed, 24 Apr 2002, Ashley M. Kirchner wrote:
> 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?
Someone else has already provided you with a regex. I'll provide you with
a new question: Why store it that way? Just create a new field to hold the
name of the user who last modified the description. Then you don't have to
do all that processing, and you aren't unnecessarily intermingling
formatting with data.
miguel