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

From: Date: Fri, 09 Jul 1999 14:09:39 +0000
Subject: Re: Re: Bug #1683 Updated: Failing to parse/compile a *? pattern.
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-8249@lists.php.net to get a copy of this message
But, $body=eregi_replace("&lt;([^:]*://[^ >\n\t]*)&gt;", "<a href=\"\\1\">\\1</a>", $body); works without an error, and $body=eregi_replace("&lt;([^:]*://[^ [.&gt;.]\n\t]*)&gt;", "<a href=\"\\1\">\\1</a>", $body); gives me: Warning: REG_ECOLLATE in /home/roy/public_html/phorum/post.php3 on line 187 Don't let the & and ; confuse anything, [.gt.] gives me the same error. The "bug" in the original code is that the > has been turned into an escaped &gt;, so it has to match the first one and not the last one, or all the links are turned into a single huge link between the first &lt; and the last &gt;. The [^ >] doesnt prevent that of course. [^ [.&gt;.]] should. -Jonathan *********** REPLY SEPARATOR *********** On 7/9/99 at 9:53 AM Rasmus Lerdorf wrote: >> No, actually, I was referring to stuff that is explained in the regex.7 >> POSIX spec man page you include with php. >> >> Paragraph 9: >> >> Within a bracket expression, a collating element (a char- >> acter, a multi-character sequence that collates as if it >> were a single character, or a collating-sequence name for >> either) enclosed in [.' and .]' stands >> for the sequence >> of characters of that collating element. The sequence is >> a single element of the bracket expression's list. A >> bracket expression containing a multi-character collating >> element can thus match more than one character, e.g. if >> the collating sequence includes a `ch' collating element, >> then the RE `[[.ch.]]*c' matches the first five characters >> of `chchcc'. >> >> But no matter. preg with non-greedy matching will do it, if I can ever >> make preg work. In my stand alone test program, the preg regexp "/\//" is >> fine and works. In the actual program I'm trying to replace an egreg with >> it, it tells me "illegal escape sequence \/". I'm about to give up and let >> someone else fix this Phorum bug. :) > >But collating elements work fine. eg. > > echo ereg_replace("[.ch.]+c", "bob", "chchcc tom"); > >this prints: "bob tom" > >-Rasmus --- Jonathan Roy - roy@idle.com - Idle Communications, Inc.

« previous php.dev (#8249) next »