This means that PRCE was compiled with the -enable-utf8 configure option which allows PCRE to recognize and work with UTF-8 encoded strings. Notice the “UTF-8 support” and the “No Unicode properties support” lines. After much digging around, I found that this isn’t necessarily CentOS’s fault as this package has carried over from the RHEL (Red Hat Enterprise Linux) side of things.Ī great way of checking to see if this is an issue on your system is by running the following: $ pcretest -C This support is something that must be an option that PCRE is compiled with, and my CentOS repository only has packages that don’t include that support. I hoped to find something like pcre-utf8, pcre-unicode, php-pcre-unicode, or something to make it simple and quick to add this support since I much prefer using package management tools rather than compiling and installing from source.
What version of rhel 6 has php 5.2 install#
I searched around for a while thinking that I could simply install a new package using yum. It looked like the error was coming from PCRE itself. Pcregrep: Error in command-line regex at offset 2: support for \P, \p, and \X has not been compiled I ended up with something very similar: $ pcregrep '/\X*/u' character.txt I found out that I could query PCRE directly. Since PHP uses the PCRE engine to run regular expressions, I started to dig into it.
Amazingly, having the \X outside of the square brackets changed everything as I now received the following very concerning warning: PHP Warning: preg_match(): Compilation failed: support for \P, \p, and \X has not been compiled at offset 2 in wp-content/plugins/dnsyogi/testunicode.php on line 4 I wrote a really simple rule by simply looking for /^\X$/ and testing the regex with a single Unicode character. I had the regex testing characters ( \X, \pL, etc) inside of a character class, such as, since I was creating a regex to test for domains. When I removed the Unicode characters from the string and tested again, it would work. Unfortunately, every time I ran a test with a string that contained Unicode characters, the match failed. I started writing some regex strings and testing the code. The reason that I needed to dig in deep on regular expression syntax with PHP is because I needed to write some regular expressions that deal with Unicode characters.Īfter much reading, I believed that I knew everything that I needed.
What version of rhel 6 has php 5.2 how to#
Yesterday, I talked about how to get the most out of running regular expressions in PHP.