]> git.sur5r.net Git - i3/i3/blobdiff - src/regex.c
Merge branch 'fix-dump-log-errmsg'
[i3/i3] / src / regex.c
index f419e4bbf4e7d1a3cf739b17d12efeb74b1d6c85..a0b51f66d2be15cfc4670d3e5011e42a902ad4d7 100644 (file)
@@ -4,9 +4,9 @@
  * i3 - an improved dynamic tiling window manager
  * © 2009-2011 Michael Stapelberg and contributors (see also: LICENSE)
  *
+ * regex.c: Interface to libPCRE (perl compatible regular expressions).
  *
  */
-
 #include "all.h"
 
 /*
@@ -25,9 +25,12 @@ struct regex *regex_new(const char *pattern) {
 
     struct regex *re = scalloc(sizeof(struct regex));
     re->pattern = sstrdup(pattern);
+    int options = PCRE_UTF8;
+#ifdef PCRE_HAS_UCP
     /* We use PCRE_UCP so that \B, \b, \D, \d, \S, \s, \W, \w and some POSIX
      * character classes play nicely with Unicode */
-    int options = PCRE_UCP | PCRE_UTF8;
+    options |= PCRE_UCP;
+#endif
     while (!(re->regex = pcre_compile2(pattern, options, &errorcode, &error, &offset, NULL))) {
         /* If the error is that PCRE was not compiled with UTF-8 support we
          * disable it and try again */