[gnome-terminal] regex: Workaround a PCRE bug resulting in not recognizing schemeless URLs



commit bb808a756935adbdf2bf950ae100c907374292b9
Author: Egmont Koblinger <egmont gmail com>
Date:   Wed Feb 26 18:52:46 2020 +0100

    regex: Workaround a PCRE bug resulting in not recognizing schemeless URLs
    
    https://gitlab.gnome.org/GNOME/gnome-terminal/issues/221

 src/terminal-regex.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
---
diff --git a/src/terminal-regex.h b/src/terminal-regex.h
index 118cf9fc..143a8fa0 100644
--- a/src/terminal-regex.h
+++ b/src/terminal-regex.h
@@ -150,7 +150,11 @@
 /* TODO: also support file:/etc/passwd */
 #define REGEX_URL_FILE   DEFS "(?ix: file:/ (?: / (?: " HOSTNAME1 " )? / )? (?! / ) )(?&PATH)"
 /* Lookbehind so that we don't catch "abc.www.foo.bar", bug 739757. Lookahead for www/ftp for convenience 
(so that we can reuse HOSTNAME1). */
-#define REGEX_URL_HTTP   DEFS "(?<!(?:" HOSTNAMESEGMENTCHARS_CLASS "|[.]))(?=(?i:www|ftp))" HOSTNAME1 PORT 
URLPATH
+/* The commented-out variant looks more like our other definitions, but fails with PCRE 10.34. See 
GNOME/gnome-terminal#221.
+ * TODO: revert to this nicer pattern some time after 10.35's release.
+ * #define REGEX_URL_HTTP   DEFS "(?<!(?:" HOSTNAMESEGMENTCHARS_CLASS "|[.]))(?=(?i:www|ftp))" HOSTNAME1 
PORT URLPATH
+ */
+#define REGEX_URL_HTTP   APOS_START_DEF "(?<!(?:" HOSTNAMESEGMENTCHARS_CLASS "|[.]))(?=(?i:www|ftp))" 
HOSTNAME1 PORT PATH_INNER_DEF PATH_DEF URLPATH
 #define REGEX_URL_VOIP   DEFS "(?i:h323:|sips?:)" USERPASS URL_HOST PORT VOIP_PATH
 #define REGEX_EMAIL      DEFS "(?i:mailto:)?" USER "@" EMAIL_HOST
 #define REGEX_NEWS_MAN   "(?i:news:|man:|info:)[-[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]