R - Regular Expression error (PCRE Version)
<p>I'm trying to use <code>koRpus</code> in R to do lemmatization on a Linux server running RHEL6.  Last week when I had MRO (Microsoft R Open) 3.2.3 installed the code below worked great:</p>

<pre><code>library(koRpus)
lw = c("dancing","flying","flew")
res = treetag(lw,treetagger="manual",format="obj",TT.tknz = F, lang="en",
        TT.options=list(path="/usr/local/bin/TreeTagger",preset="en"))
</code></pre>

<p>Now that I'm running MRO 3.3.0 though I get the following error:</p>

<pre><code>Error in grepl("(^\\p{P}*\\p{L}\\p{M}*\\.)", tkn, perl = TRUE) :
  invalid regular expression '(^\p{P}*\p{L}\p{M}*\.)'
In addition: Warning message:
In grepl("(^\\p{P}*\\p{L}\\p{M}*\\.)", tkn, perl = TRUE) :
  PCRE pattern compilation error
        'support for \P, \p, and \X has not been compiled'
        at 'p{P}*\p{L}\p{M}*\.)'
</code></pre>

<p>OK, so that means my PCRE needs to be recompiled with unicode support.  In fact when I run the code below I see that's the exact issue.  I also see that I'm running version 8.37.</p>

<pre><code>pcre_config()
#&gt;         UTF-8 Unicode properties                JIT
#&gt;          TRUE              FALSE              FALSE

extSoftVersion()
#&gt;                 zlib                     bzlib                        xz
#&gt;              "1.2.8"      "1.0.6, 6-Sept-2010"                   "5.2.2"
#&gt;                 PCRE                       ICU                       TRE
#&gt;    "8.37 2015-04-28"                    "57.1" "TRE 0.8.0 R_fixes (BSD)"
#&gt;                iconv
#&gt;         "glibc 2.12"
</code></pre>

<p>Now, I went ahead and installed 8.39 and with (hopefully) the right flags set.</p>

<pre><code>./configure --enable-utf8 --enable-unicode-properties
make
make install
</code></pre>

<p>So now when I run <code>pcretest -C</code> I get</p>

<pre><code>PCRE version 8.39 2016-06-14
Compiled with
  8-bit support
  UTF-8 support
  Unicode properties support
  No just-in-time compiler support
  Newline sequence is LF
  \R matches all Unicode newlines
  Internal link size = 2
  POSIX malloc threshold = 10
  Parentheses nest limit = 250
  Default match limit = 10000000
  Default recursion depth limit = 10000000
  Match recursion uses stack
</code></pre>

<p>But when I launch R again my <code>pcre_config()</code> yields identical results, the <code>treetag</code> call fails identically and <code>extSoftVersion()</code> still reports 8.37.</p>

<p><strong>What do I need to do for R to start using the new PCRE version?</strong></p>

<p>Deeper and deeper...
R apparently no longer ships with PCRE (per <a href="https://mran.microsoft.com/news/#r330" rel="nofollow">https://mran.microsoft.com/news/#r330</a>) as of 3.3.0 so it (supposedly) relies on the system PCRE installation.  I went through the server and removed every PCRE file identifiable (complete uninstallation) and R still reports <code>PCRE 8.37 2015-04-28</code> which suggests the MRO 3.3.0 for RHEL 6 includes PCRE despite claiming otherwise.  Additionally, the <code>grepl</code> command still fails with the error too, so it's not just an issue with <code>extSoftVersion</code>.</p>