[pcre-dev] [Bug 2673] Regex cannot be compiled if source com…

Kezdőlap
Üzenet törlése
Szerző: admin
Dátum:  
Címzett: pcre-dev
Tárgy: [pcre-dev] [Bug 2673] Regex cannot be compiled if source compiled with std=c18
https://bugs.exim.org/show_bug.cgi?id=2673

--- Comment #5 from Petr Pisar <ppisar@???> ---
Nonetheless you have a typo in the code:

static const char pattern[] =
"^((?<scheme>[^:/?#]+):)?(?<authority>//(((?<userinfo>[^/?#]*)@)?(?<host>[^/?#:]*)(?:(?<port>[^/?#]*))?))?(?<path>[^?#]*)(\?(?<query>[^#]*))?(#(?<fragment>.*))?";

                                                                        ^
You need to escape the backslash because it's a special character in C string:


static const char pattern[] =
"^((?<scheme>[^:/?#]+):)?(?<authority>//(((?<userinfo>[^/?#]*)@)?(?<host>[^/?#:]*)(?:(?<port>[^/?#]*))?))?(?<path>[^?#]*)(\\?(?<query>[^#]*))?(#(?<fragment>.*))?";

Then PCRE parses the expression correctly because it will see (\?( instead of
(?(.

--
You are receiving this mail because:
You are on the CC list for the bug.