diff --git a/src/Makefile.am b/src/Makefile.am
index 3e5315b..ce8649f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -6,6 +6,8 @@ bin_PROGRAMS = gnome-terminal
 libexec_PROGRAMS = gnome-terminal-server
 noinst_PROGRAMS =
 
+check_PROGRAMS = terminal-regex
+
 if WITH_NAUTILUS_EXTENSION
 nautilusextension_LTLIBRARIES = libterminal-nautilus.la
 endif # WITH_NAUTILUS_EXTENSION
@@ -61,6 +63,7 @@ gnome_terminal_server_SOURCES = \
 	terminal-prefs.h \
 	terminal-profiles-list.c \
 	terminal-profiles-list.h \
+	terminal-regex.h \
 	terminal-schemas.h \
 	terminal-settings-list.c \
 	terminal-settings-list.h \
@@ -150,6 +153,26 @@ terminal-gdbus-generated.c terminal-gdbus-generated.h: org.gnome.Terminal.xml Ma
 terminal-resources.h terminal-resources.c: terminal.gresource.xml Makefile $(shell $(GLIB_COMPILE_RESOURCES) --generate-dependencies --sourcedir $(srcdir) $(srcdir)/terminal.gresource.xml)
 	$(AM_V_GEN) XMLLINT=$(XMLLINT) $(GLIB_COMPILE_RESOURCES) --target $@ --sourcedir $(srcdir) --generate --c-name terminal $<
 
+terminal_regex_CPPFLAGS = \
+	-DTERMINAL_COMPILATION \
+	-DTERM_LOCALEDIR="\"$(datadir)/locale\"" \
+	-DTERM_HELPDIR="\"$(HELP_DIR)\"" \
+	-DTERM_LIBEXECDIR="\"$(libexecdir)\"" \
+	$(AM_CPPFLAGS)
+terminal_regex_SOURCES = \
+	terminal-regex.c \
+	terminal-regex.h \
+	$(NULL)
+terminal_regex_CFLAGS = \
+	-DTERMINAL_REGEX_MAIN \
+	$(TERM_CFLAGS) \
+	$(WARN_CFLAGS) \
+	$(AM_CFLAGS)
+terminal_regex_LDFLAGS = \
+	$(AM_LDFLAGS)
+terminal_regex_LDADD = \
+	$(TERM_LIBS)
+
 # Terminal client
 
 if ENABLE_GTERMINAL
diff --git a/src/terminal-regex.c b/src/terminal-regex.c
new file mode 100644
index 0000000..9ff7eff
--- /dev/null
+++ b/src/terminal-regex.c
@@ -0,0 +1,212 @@
+/*
+ * Copyright © 2015 Egmont Koblinger
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "config.h"
+
+#include <glib.h>
+#include <stdio.h>
+
+#include "terminal-regex.h"
+
+#ifdef TERMINAL_REGEX_MAIN
+
+/* Shorthand for expecting the pattern to match the entire input string */
+#define ENTIRE ((char *) 1)
+
+static char*
+get_match (const char *pattern, const char *string, GRegexMatchFlags match_flags)
+{
+  GRegex *regex;
+  GMatchInfo *match_info;
+  gchar *match;
+
+  regex = g_regex_new (pattern, 0, 0, NULL);
+  g_regex_match (regex, string, match_flags, &match_info);
+  match = g_match_info_fetch (match_info, 0);
+
+  g_free (regex);
+  g_free (match_info);
+  return match;
+}
+
+/* Macros rather than functions to report useful line numbers on failure. */
+#define assert_match(__pattern, __string, __expected) do { \
+  gchar *__actual_match = get_match(__pattern, __string, 0); \
+  const gchar *__expected_match = __expected; \
+  if (__expected_match == ENTIRE) __expected_match = __string; \
+  g_assert_cmpstr(__actual_match, ==, __expected_match); \
+  g_free (__actual_match); \
+} while (0)
+
+#define assert_match_anchored(__pattern, __string, __expected) do { \
+  gchar *__actual_match = get_match(__pattern, __string, G_REGEX_MATCH_ANCHORED); \
+  const gchar *__expected_match = __expected; \
+  if (__expected_match == ENTIRE) __expected_match = __string; \
+  g_assert_cmpstr(__actual_match, ==, __expected_match); \
+  g_free (__actual_match); \
+} while (0)
+
+int
+main (int argc, char **argv)
+{
+  /* SCHEME is case insensitive */
+  assert_match_anchored (SCHEME, "http:",  ENTIRE);
+  assert_match_anchored (SCHEME, "HTTPS:", ENTIRE);
+  assert_match_anchored (SCHEME, "http",   NULL);    /* no colon */
+  /* TODO: what with the file: ??? how many slashes go there??? */
+
+  /* USER is nonempty, alphanumeric, dot and dash */
+  assert_match_anchored (USER, "",              NULL);
+  assert_match_anchored (USER, "dr.john-smith", ENTIRE);
+  assert_match_anchored (USER, "abc@def",       "abc");
+
+  /* PASS is optional colon-prefixed value, allowing quite some characters, but definitely not @ */
+  assert_match_anchored (PASS, "",          ENTIRE);
+  assert_match_anchored (PASS, "nocolon",   "");
+  assert_match_anchored (PASS, ":s3cr3T",   ENTIRE);
+  assert_match_anchored (PASS, ":$?#@host", ":$?#");
+
+  /* Hostnames */
+  assert_match_anchored (HOSTNAME, "example.com",       ENTIRE);
+  assert_match_anchored (HOSTNAME, "a-b.c-d",           ENTIRE);
+  assert_match_anchored (HOSTNAME, "a_b",               "a");    /* TODO: can/should we totally abort here? */
+  assert_match_anchored (HOSTNAME, "déjà-vu.com",       ENTIRE);
+  assert_match_anchored (HOSTNAME, "➡.ws",              ENTIRE);
+  assert_match_anchored (HOSTNAME, "cömbining-áccents", ENTIRE);
+
+  /* Number between 0 and 255 (helper for IPv4) */
+  assert_match_anchored (NUM_0_255, "0",    ENTIRE);
+  assert_match_anchored (NUM_0_255, "1",    ENTIRE);
+  assert_match_anchored (NUM_0_255, "9",    ENTIRE);
+  assert_match_anchored (NUM_0_255, "10",   ENTIRE);
+  assert_match_anchored (NUM_0_255, "99",   ENTIRE);
+  assert_match_anchored (NUM_0_255, "100",  ENTIRE);
+  assert_match_anchored (NUM_0_255, "200",  ENTIRE);
+  assert_match_anchored (NUM_0_255, "250",  ENTIRE);
+  assert_match_anchored (NUM_0_255, "255",  ENTIRE);
+  assert_match_anchored (NUM_0_255, "256",  NULL);
+  assert_match_anchored (NUM_0_255, "260",  NULL);
+  assert_match_anchored (NUM_0_255, "299",  NULL);
+  assert_match_anchored (NUM_0_255, "300",  NULL);
+  assert_match_anchored (NUM_0_255, "1000", NULL);
+  assert_match_anchored (NUM_0_255, "",     NULL);
+  assert_match_anchored (NUM_0_255, "a1b",  NULL);
+
+  /* IPv4 addresses */
+  assert_match_anchored (IPV4, "11.22.33.44",    ENTIRE);
+  assert_match_anchored (IPV4, "0.1.254.255",    ENTIRE);
+  assert_match_anchored (IPV4, "75.150.225.300", NULL);
+  assert_match_anchored (IPV4, "1.2.3.4.5",      "1.2.3.4");  /* we could also bail out and not match at all */
+
+  /* IPv6 addresses */
+  assert_match_anchored (IPV6, "::1",                    ENTIRE);
+  assert_match_anchored (IPV6, "dead::be:ef",            ENTIRE);
+  assert_match_anchored (IPV6, "dead:beef::192.168.1.1", ENTIRE);
+  assert_match_anchored (IPV6, "dead::beef",             ENTIRE);
+  assert_match_anchored (IPV6, "live::pork",             NULL);
+  assert_match_anchored (IPV6, "192.168.1.1",            NULL);
+
+  /* HOST is either a hostname, or an IPv4 address, or a bracket-enclosed IPv6 address */
+  assert_match_anchored (HOST, "example.com",   ENTIRE);
+  assert_match_anchored (HOST, "11.22.33.44",   ENTIRE);
+  assert_match_anchored (HOST, "[dead::be:ef]", ENTIRE);
+
+  /* Number between 1 and 65535 (helper for port) */
+  assert_match_anchored (NUM_1_65535, "0",      NULL);
+  assert_match_anchored (NUM_1_65535, "1",      ENTIRE);
+  assert_match_anchored (NUM_1_65535, "10",     ENTIRE);
+  assert_match_anchored (NUM_1_65535, "100",    ENTIRE);
+  assert_match_anchored (NUM_1_65535, "1000",   ENTIRE);
+  assert_match_anchored (NUM_1_65535, "10000",  ENTIRE);
+  assert_match_anchored (NUM_1_65535, "60000",  ENTIRE);
+  assert_match_anchored (NUM_1_65535, "65000",  ENTIRE);
+  assert_match_anchored (NUM_1_65535, "65500",  ENTIRE);
+  assert_match_anchored (NUM_1_65535, "65530",  ENTIRE);
+  assert_match_anchored (NUM_1_65535, "65535",  ENTIRE);
+  assert_match_anchored (NUM_1_65535, "65536",  NULL);
+  assert_match_anchored (NUM_1_65535, "65540",  NULL);
+  assert_match_anchored (NUM_1_65535, "65600",  NULL);
+  assert_match_anchored (NUM_1_65535, "66000",  NULL);
+  assert_match_anchored (NUM_1_65535, "70000",  NULL);
+  assert_match_anchored (NUM_1_65535, "100000", NULL);
+  assert_match_anchored (NUM_1_65535, "",       NULL);
+  assert_match_anchored (NUM_1_65535, "a1b",    NULL);
+
+  /* PORT is an optional colon-prefixed value */
+  assert_match_anchored (PORT, "",       ENTIRE);
+  assert_match_anchored (PORT, ":1",     ENTIRE);
+  assert_match_anchored (PORT, ":65535", ENTIRE);
+  assert_match_anchored (PORT, ":65536", "");     /* TODO: can/should we totally abort here? */
+
+  /* TODO: add tests for PATHCHARS and PATHNONTERM; and/or URLPATH */
+  assert_match_anchored (URLPATH, "/ab/cd",       ENTIRE);
+  assert_match_anchored (URLPATH, "/ab/cd.html.", "/ab/cd.html");
+
+  /* Put the components together and test the big picture */
+
+  assert_match (REGEX_URL_AS_IS, "There's no URL here http:/foo",            NULL);
+  assert_match (REGEX_URL_AS_IS, "Visit http://example.com for details",     "http://example.com");
+  assert_match (REGEX_URL_AS_IS, "Trailing dot http://foo/bar.html.",        "http://foo/bar.html");
+  assert_match (REGEX_URL_AS_IS, "Trailing ellipsis http://foo/bar.html...", "http://foo/bar.html");
+  assert_match (REGEX_URL_AS_IS, "See <http://foo/bar>",                     "http://foo/bar");
+  assert_match (REGEX_URL_AS_IS, "<http://foo.bar/asdf.qwer.html>",          "http://foo.bar/asdf.qwer.html");
+
+  assert_match (REGEX_URL_AS_IS, "http://",          NULL);
+  assert_match (REGEX_URL_AS_IS, "http://a",         ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://aa.",       "http://aa");
+  assert_match (REGEX_URL_AS_IS, "http://aa.b",      ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://aa.bb",     ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://aa.bb/c",   ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://aa.bb/cc",  ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://aa.bb/cc/", ENTIRE);
+
+  assert_match (REGEX_URL_AS_IS, "HtTp://déjà-vu.com:10000/déjà/vu",    ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "HTTP://joe:sEcReT@➡.ws:1080",         ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "https://cömbining-áccents",           ENTIRE);
+
+  assert_match (REGEX_URL_AS_IS, "https://[dead::beef]:12345/ipv6",     ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "https://[dead::beef:11.22.33.44]",    ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "https://dead::beef/no-brackets-ipv6", "https://dead");  /* TODO: can/should we totally abort here? */
+
+  assert_match (REGEX_URL_AS_IS, "http://111.222.333.444/",             ENTIRE);  /* FIXME it matches this as a hostname, not as IPv4 */
+  assert_match (REGEX_URL_AS_IS, "http://1.2.3.4:70000",                "http://1.2.3.4");  /* TODO: can/should we totally abort here? */
+  assert_match (REGEX_URL_AS_IS, "http://[dead::beef:111.222.333.444]",  NULL);
+
+  /* Valid IP addresses */
+  assert_match (REGEX_URL_AS_IS, "http://111.222.33.44/foo", ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://1.2.3.4:5555/xyz",  ENTIRE);
+
+  /* Username, password */
+  assert_match (REGEX_URL_AS_IS, "http://joe@example.com",                 ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://user.name:sec.ret@host.name",     ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://joe:secret@[::1]",                ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://dudewithnopassword:@example.com", ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://safeguy:!#$%^&*@host",            ENTIRE);
+  assert_match (REGEX_URL_AS_IS, "http://invalidusername!@host",           "http://invalidusername");
+
+  assert_match (REGEX_URL_AS_IS, "http://ab.cd/ef?g=h&i=j|k=l#m=n:o=p", ENTIRE);
+
+  /* Email */
+  assert_match (REGEX_EMAIL, "Write to foo@bar.com.",        "foo@bar.com");
+  assert_match (REGEX_EMAIL, "Write to <foo@bar.com>",       "foo@bar.com");
+  assert_match (REGEX_EMAIL, "Write to mailto:foo@bar.com.", "mailto:foo@bar.com");
+
+  printf("terminal-screen regex tests passed :)\n");
+  return 0;
+}
+
+#endif /* TERMINAL_REGEX_MAIN */
diff --git a/src/terminal-regex.h b/src/terminal-regex.h
new file mode 100644
index 0000000..6a6aec1
--- /dev/null
+++ b/src/terminal-regex.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright © 2015 Egmont Koblinger
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef TERMINAL_REGEX_H
+#define TERMINAL_REGEX_H
+
+#define SCHEME "(?ix: news: | telnet: | nntp: | file:/ | https?: | ftps?: | sftp: | webcal: )"
+
+#define USERCHARS "-.[:alnum:]"
+/* Nonempty username, e.g. "john.smith" */
+#define USER "[" USERCHARS "]+"
+
+#define PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.:/!%$^*&~\"#'\\E]"
+/* Optional colon-prefixed password. I guess empty password should be allowed, right? E.g. ":secret", ":", "" */
+#define PASS "(?x: :" PASSCHARS_CLASS "* )?"
+
+/* Optional at-terminated username (with perhaps a password too), e.g. "joe@", "pete:secret@", "" */
+/* TODO: move '.' to USERCHARS, adjust e-mail pattern */
+/* TODO: why is @ backslashed? */
+#define USERPASS "(?:" USER PASS "\\@)?"
+
+/* Number between 0 and 255, with lookahead at the end so that we don't match "25" in the string "256".
+   The lookahead could go to the last segment of IPv4 only but this construct allows nicer unittesting. */
+#define NUM_0_255 "(?x: (?: 0 | 1[0-9]{0,2} | 2(?: [0-4][0-9]? | 5[0-5]? | 2[6-9][0-9]? )? | [3-9][0-9]? ) (?! [0-9] ) )"
+
+/* Decimal IPv4, e.g. "1.2.3.4" */
+#define IPV4 "(?x: (?: " NUM_0_255 "\\. ){3} " NUM_0_255 " )"
+
+/* IPv6, including embedded IPv4, e.g. "::1", "dead:beef::1.2.3.4".
+ * Lookahead for the next char not being a dot or digit, so it doesn't get stuck matching "dead:beef::1" in "dead:beef::1.2.3.4".
+ * This is not required since the surrounding brackets would trigger backtracking, but it allows nicer unittesting.
+ * TODO: more strict check (right number of colons, etc.)
+ * TODO: add zone_id: RFC 4007 section 11, RFC 6874 */
+#define IPV6 "(?x: [:[:xdigit:]]+ (?: :" IPV4 " )? (?! [.0-9] ) )"
+
+/* Either an alphanumeric character or dash; or if [negative lookahead] not ASCII
+ * then any graphical Unicode character.
+ * (Note: PCRE doesn't support character class subtraction/intersection.) */
+#define HOSTNAMECHARS_CLASS "(?x: [-[:alnum:]] | (?! [[:ascii:]] ) [[:graph:]] )"
+/* Note: currently HOSTNAME matches IPv4 addresses too. No problem */
+#define HOSTNAME HOSTNAMECHARS_CLASS "+(\\." HOSTNAMECHARS_CLASS "+)*"
+
+/* Hostname, IPv4, or bracket-enclosed IPv6, e.g. "example.com", "1.2.3.4", "[::1]" */
+#define HOST "(?:" HOSTNAME "|" IPV4 "|\\[" IPV6 "\\])"
+
+/* Number between 0 and 65535, with lookahead at the end so that we don't match "6789" in the string "67890". */
+#define NUM_1_65535 "(?x: (?: [1-5][0-9]{0,4} | 6(?: [0-4][0-9]{0,3} | 5(?: [0-4][0-9]{0,2} | 5(?: [0-2][0-9]? | 3[0-5]? | [4-9]? )? | [6-9][0-9]{0,1} )? | [6-9][0-9]{0,2} )? | [7-9][0-9]{0,3} ) (?! [0-9] ) )"
+
+/* Optional colon-prefixed port, e.g. ":1080", "" */
+#define PORT "(?x: \\:" NUM_1_65535 " )?"
+
+#define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#|%\\E]"
+/* Chars not to end a URL */
+#define PATHNONTERM_CLASS "[\\Q.!,?\\E]"
+
+/* Lookbehind at the end, so that the last character (if we matched a character at all) is not from PATHTERM_CLASS */
+#define URLPATH "(?x: /" PATHCHARS_CLASS "* (?<! " PATHNONTERM_CLASS " ) )?"
+
+/* Now let's put these fragments together */
+
+#define REGEX_URL_AS_IS  SCHEME "//" USERPASS HOST PORT URLPATH
+#define REGEX_URL_HTTP   "(?:www|ftp)" HOSTNAMECHARS_CLASS "*\\." HOST PORT URLPATH
+#define REGEX_URL_VOIP   "(?:callto:|h323:|sip:)" USER "(?:" PORT "/[a-z0-9]+)?\\@" HOST
+#define REGEX_EMAIL      "(?:mailto:)?" USER "\\@" HOSTNAMECHARS_CLASS "+\\." HOST
+#define REGEX_NEWS_MAN   "(?:news:|man:|info:)[-[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+"
+
+#endif /* !TERMINAL_REGEX_H */
diff --git a/src/terminal-screen.c b/src/terminal-screen.c
index 9aa7bbe..ed86b48 100644
--- a/src/terminal-screen.c
+++ b/src/terminal-screen.c
@@ -23,6 +23,7 @@
 #include "terminal-pcre2.h"
 #endif
 
+#include "terminal-regex.h"
 #include "terminal-screen.h"
 
 #include <errno.h>
@@ -165,34 +166,21 @@ static void terminal_screen_set_override_command (TerminalScreen  *screen,
 
 static guint signals[LAST_SIGNAL];
 
-#define USERCHARS "-[:alnum:]"
-#define USERCHARS_CLASS "[" USERCHARS "]"
-#define PASSCHARS_CLASS "[-[:alnum:]\\Q,?;.:/!%$^*&~\"#'\\E]"
-#define HOSTCHARS_CLASS "[-[:alnum:]]"
-#define HOST HOSTCHARS_CLASS "+(\\." HOSTCHARS_CLASS "+)*"
-#define PORT "(?:\\:[[:digit:]]{1,5})?"
-#define PATHCHARS_CLASS "[-[:alnum:]\\Q_$.+!*,:;@&=?/~#%\\E]"
-#define PATHTERM_CLASS "[^\\Q]'.:}>) \t\r\n,\"\\E]"
-#define SCHEME "(?:news:|telnet:|nntp:|file:\\/|https?:|ftps?:|sftp:|webcal:)"
-#define USERPASS USERCHARS_CLASS "+(?:" PASSCHARS_CLASS "+)?"
-#define URLPATH   "(?:(/"PATHCHARS_CLASS"+(?:[(]"PATHCHARS_CLASS"*[)])*"PATHCHARS_CLASS"*)*"PATHTERM_CLASS")?"
-
 typedef struct {
   const char *pattern;
   TerminalURLFlavor flavor;
-  gboolean caseless;
 } TerminalRegexPattern;
 
 static const TerminalRegexPattern url_regex_patterns[] = {
-  { SCHEME "//(?:" USERPASS "\\@)?" HOST PORT URLPATH, FLAVOR_AS_IS, TRUE },
-  { "(?:www|ftp)" HOSTCHARS_CLASS "*\\." HOST PORT URLPATH , FLAVOR_DEFAULT_TO_HTTP, TRUE  },
-  { "(?:callto:|h323:|sip:)" USERCHARS_CLASS "[" USERCHARS ".]*(?:" PORT "/[a-z0-9]+)?\\@" HOST, FLAVOR_VOIP_CALL, TRUE },
-  { "(?:mailto:)?" USERCHARS_CLASS "[" USERCHARS ".]*\\@" HOSTCHARS_CLASS "+\\." HOST, FLAVOR_EMAIL, TRUE },
-  { "(?:news:|man:|info:)[-[:alnum:]\\Q^_{|}~!\"#$%&'()*+,./;:=?`\\E]+", FLAVOR_AS_IS, TRUE },
+  { REGEX_URL_AS_IS, FLAVOR_AS_IS },
+  { REGEX_URL_HTTP,  FLAVOR_DEFAULT_TO_HTTP },
+  { REGEX_URL_VOIP,  FLAVOR_VOIP_CALL },
+  { REGEX_EMAIL,     FLAVOR_EMAIL },
+  { REGEX_NEWS_MAN,  FLAVOR_AS_IS },
 };
 
 static const TerminalRegexPattern extra_regex_patterns[] = {
-  { "(0[Xx][[:xdigit:]]+|[[:digit:]]+)", FLAVOR_NUMBER, FALSE },
+  { "(0[Xx][[:xdigit:]]+|[[:digit:]]+)", FLAVOR_NUMBER },
 };
 
 #ifdef WITH_PCRE2
@@ -256,8 +244,7 @@ precompile_regexes (const TerminalRegexPattern *regex_patterns,
 
 #ifdef WITH_PCRE2
       (*regexes)[i] = vte_regex_new (regex_patterns[i].pattern, -1,
-                                     PCRE2_UTF | PCRE2_NO_UTF_CHECK |
-                                     (regex_patterns[i].caseless ? PCRE2_CASELESS : 0),
+                                     PCRE2_UTF | PCRE2_NO_UTF_CHECK,
                                      &error);
       g_assert_no_error (error);
 
@@ -268,8 +255,7 @@ precompile_regexes (const TerminalRegexPattern *regex_patterns,
       }
 #else
       (*regexes)[i] = g_regex_new (regex_patterns[i].pattern,
-                                   G_REGEX_OPTIMIZE |
-                                   (regex_patterns[i].caseless ? G_REGEX_CASELESS : 0),
+                                   G_REGEX_OPTIMIZE,
                                    0, &error);
       g_assert_no_error (error);
 #endif
