Re: Re: Bug #1683 Updated: Failing to parse/compile a *? pattern.

From: Date: Fri, 09 Jul 1999 14:16:55 +0000
Subject: Re: Re: Bug #1683 Updated: Failing to parse/compile a *? pattern.
References: 1 2 3 4  Groups: php.dev 
Request: Send a blank email to php-dev+get-8250@lists.php.net to get a copy of this message
Jonathan Roy wrote: > where the 2nd * being greedy means two links on the same line are treated > like a single long link. I want the second * to be non-greedy. So in theory > I just do this: > > $body=preg_replace("/&lt;([^:]*:\/\/[^ >\n\t]*?)&gt;/i", "<a > href=\"\\1\">\\1</a>", $body); > > [snipped] > > creates no error message. If you want to reproduce this, and happen to > have phorum yourself, put my small preg_replace command in around line 183 > or so of post.php3, after the closing } and before the two egrei_replace > commands. This is with Apache 1.3.6, php 3.0.11, on a linux redhat 5 > machine. I don't have Phorum installed so I can't test it in that environment, but it should give you the same error if it's in a standalone script. If you can reproduce this in a simple script I will definitely take a closer look at it. For now, try using different delimiters so that you don't have to escape the forward slash, i.e. do: $body=preg_replace("#&lt;([^:]*://[^ >\n\t]*?)&gt;#i", "<a href=\"\\1\">\\1</a>", $body); or something similar. -Andrey "Later in this talk, I intend to define the universe and give three examples." -- Larry Wall

« previous php.dev (#8250) next »