View Full Version : PCRE Error Message 'Compilation failed:' ???

04-02-2003, 04:10 AM
Hi Guys, I have a script that ran fine forever, now, with PHP 4.3.1 (maybe) or other reasons that I don't know.

This is the error

Compilation failed: PCRE does not support \L, \l, \N, \P, \p, \U, \u, or \X at offset 1

this is the PHP

preg_match("/\\$key/i", $line

I am doing a chop() to the string before.

I am stuck, any ideas?


04-02-2003, 04:38 AM
Check out

http://www.google.ca/search?q=Compilation+failed%3A+PCRE+does+not+support+%5CL%2C+%5Cl%2C+%5CN%2C+%5CP%2C+%5Cp%2C+%5CU%2C +%5Cu%2C+or+%5CX&ie=ISO-8859-1&hl=en&btnG=Google+Search&meta=

Google Link.

Lots of people have this error!!!

04-02-2003, 05:36 AM
Dunno, bro. Sorry

However, many of the Google results seem to be PostNuke sites....

04-02-2003, 05:39 AM
Thanks for the feedback!

Whew, this is killing me. And ya, I have a demo tommorow morning. What do tey call that? Murphys law.

04-02-2003, 05:42 AM
Hmmm, according to some text-file (http://www.pcre.org/pcre.txt) at pcre.org
4. The following Perl escape sequences are not supported:
\l, \u, \L, \U, \P, \p, and \X. In fact these are imple-
mented by Perl's general string-handling and are not part of
its pattern matching engine. If any of these are encountered
by PCRE, an error is generated.
So, are you force-escaping any character that comes through? You should only escape what's necessary

04-02-2003, 05:45 AM
AHHHH, yes, I think I need to clean up the string '$line' abit more...


It worked untill I went to 4.3.1

04-02-2003, 05:47 AM
4.3.1 must be more strict in implementing PCRE then, or your error-reporting has changed.

04-02-2003, 06:25 AM
The error reporting give me a warning, but it doesn't work at all.

I wonder what '\L, \l, \N, \P, \p, \U, \u, or \X' are? Returns? Tab?

I am trying to str_replace them, but I am having no luck

$line = str_replace("/\L", "", $line);
$line = str_replace("\\L", "", $line);
$line = str_replace("\L", "", $line);


04-02-2003, 06:27 AM
In the line you gave before, what is $key ?

04-02-2003, 06:35 AM
What I am doing is datastriping a website. $key is an array with a bunch of thing that I am trying to match, if it matches I record that in the database. If I '@' the preg at least the script won't crash my server. But the script no longer works right.

Beets, thanks for the support, I am heading home. I might try this later on tonight.