🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.php
Article #219945

Re: formularze i wyrażenia regularne problem

#219945
From: Krzysiek
Date: Sat, 01 Aug 2009 14:15
21 lines
1790 bytes
> Krzysiek wrote:
> 
>> Mam pytanko, otóż mam jakiś $tekst=$teksPoczatek.$tekstKoniec
>> Zmienne $teksPoczatek i $tekstKoniec są przekazywane z formularza
>> $tekst jest następnie w postaci HTML wysyłane mailem.
>>
>> Problem pojawia się gdy próbuję zastąpić \n na <br>
>> $text=str_replace('\n', '<br>', $textPoczatek.$textKoniec)
>> - pomiędzy $teksPoczatek i $tekstKoniec wskakuje mi kilka <br> a
>> chciałbym tylko jedno :).
>>
>> Zakładam że należy użyć wyrażeń regularnych
> 
> trim()
> 
no ale trim() usuwa wszytkie \n – chodzi o to żeby jedno \n bądź więcej, 
bądź \n kilka znaków i znowu  \n zostało zastąpione jednym <br>

  .... tak myślę że może dać na początek wymianę \n na <br> i później 
<br>+ na jednego <br>….
Technical Details
Message-ID: <h51ifd$1e0$1@node2.news.atman.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed.atman.pl!not-for-mail
References: <h4ud9u$l0g$1@node2.news.atman.pl> <h4uei4$1n$1@nemesis.news.neostrada.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!newsfeed.pionier.net.pl!news.nask.pl!news.nask.org.pl!newsfeed.atman.pl!not-for-mail
From: Krzysiek <kczarnacki@gmail.com>
Newsgroups: pl.comp.lang.php
Subject: Re: formularze i wyrażenia regularne problem
Date: Sat, 01 Aug 2009 16:15:10 +0200
Organization: ATMAN
Lines: 21
Message-ID: <h51ifd$1e0$1@node2.news.atman.pl>
References: <h4ud9u$l0g$1@node2.news.atman.pl> <h4uei4$1n$1@nemesis.news.neostrada.pl>
NNTP-Posting-Host: chello084010034042.chello.pl
Mime-Version: 1.0
X-Trace: node2.news.atman.pl 1249135917 1472 84.10.34.42 (1 Aug 2009 14:11:57 GMT)
X-Complaints-To: usenet@atman.pl
NNTP-Posting-Date: Sat, 1 Aug 2009 14:11:57 +0000 (UTC)
User-Agent: Thunderbird 1.5.0.14 (Windows/20071210)
In-Reply-To: <h4uei4$1n$1@nemesis.news.neostrada.pl>
X-Antivirus: avast! (VPS 090731-0, 2009-07-31), Outbound message
X-Antivirus-Status: Clean
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit