Re: Problem with RegEx for BBCode
| From: | Asmann, Roland | Date: | Sat, 27 Nov 2010 17:50:32 +0000 |
| Subject: | Re: Problem with RegEx for BBCode | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309716@lists.php.net to get a copy of this message | ||
On 27-11-10 18:44, Asmann, Roland wrote:
> On 27-11-10 17:24, Daniel P. Brown wrote:
> > On Sat, Nov 27, 2010 at 08:57, Asmann, Roland <Roland.Asmann@adesso.at>
> > wrote:
> > > Hi all,
> > >
> > > I am playing around with PHP and BBCodes and have found some regex's
> > > that should transform my BBCode into correct HTML when rendering.
> > > However, I have found that if the BBCode is not correct (eg missing
> > > closing tag), the regex completely eats my input and my page is empty!
> > [snip!]
> > >
> > > What I would like is that when no closing tag is found, the opening tag
> > > should just be shown as-is. Anybody have any idea how I can do this?
> >
> >
> > Have you checked into the built-in BBCode library?
> >
> > http://php.net/bbcode
>
> I'm afraid that is not an option, I don't have that package installed
> and am not allowed to install anything on the server either...
Besides, what I don't really understand is WHY does this happen? Any
other language that has RegEx doesn't match a thing in my example and
just returns the original input. Why is PHP different in this regard?
--
Roland Asmann
Senior Software Engineer
adesso Austria GmbH
Floridotower 26. Stock T +43 1 2198790-27
Floridsdorfer Hauptstr. 1 F +43 1 2198790-927
A-1210 Wien M +43 664 88657566
E roland.asmann@adesso.at
W www.adesso.at
-------------------------------------------------------------
>>> business. people. technology. <<<
-------------------------------------------------------------