🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: preg_replace problem

#232322
From: Borys Pogoreło
Date: Tue, 26 Mar 2019 16:29
15 lines
1293 bytes
Dnia Tue, 26 Mar 2019 14:55:26 +0100, Jakub napisał(a):

> $str = 
> preg_replace('#\\/+|\.+|\++|\*+|\?+|\[+|\^+|\]+|\$+|\(+|\)+|\{+|\}+|\=+|\!+|\<+|\>+|\|+|\:+|\-+|\\\+|_+|@+|%+|&+|\#+|"+|&+|\'+|;+|,+|~+|`+#', 
> 'TO TU WSTAWIĆ ABY ZASTĄPIŁO POJEDYNCZYM ZNAKIEM', $str);

Czemu zastosowałeś taki łamaniec zamiast użyć zakresu znaków [abc...]?

Bo podejrzewam, że chcesz uzyskać coś takiego:
preg_replace('/([*.|+icotamjeszcze])\\1+/', '$1', $str);


-- 
Borys Pogoreło
borys(#)leszno,edu,pl
Technical Details
Message-ID: <11fhfah5y47m1$.k0pjisubosp0.dlg@40tude.net>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.promontel.net.pl!not-for-mail
References: <q7db0d$ld9$1@news.icm.edu.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.icm.edu.pl!news.promontel.net.pl!not-for-mail
From: Borys Pogoreło <borys@pl.edu.leszno>
Newsgroups: pl.comp.lang.php
Subject: Re: preg_replace problem
Date: Tue, 26 Mar 2019 17:29:12 +0100
Organization: snafu
Lines: 15
Message-ID: <11fhfah5y47m1$.k0pjisubosp0.dlg@40tude.net>
References: <q7db0d$ld9$1@news.icm.edu.pl>
NNTP-Posting-Host: public-gprs214027.centertel.pl
Mime-Version: 1.0
X-Trace: thunar.promontel.net.pl 1553617692 20296 46.134.175.76 (26 Mar 2019 16:28:12 GMT)
X-Complaints-To: abuse@promontel.net.pl
NNTP-Posting-Date: Tue, 26 Mar 2019 16:28:12 +0000 (UTC)
User-Agent: 40tude_Dialog/2.0.14.1pl
X-fnord: obey.
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit