title: What does \x in PHP PCRE mean?
body: <p>From <a href="http://www.php.net/manual/en/regexp.reference.escape.php" rel="noreferrer">the manual</a>:</p>
  
  <blockquote>
    <p>After <code>\x</code>, up to two hexadecimal digits are read (letters can be in
    upper or lower case). In UTF-8 mode, <code>\x{...}</code> is allowed, where the
    contents of the braces is a string of hexadecimal digits. It is
    interpreted as a UTF-8 character whose code number is the given
    hexadecimal number. <strong>The original hexadecimal escape sequence, <code>\xhh</code>,
    matches a two-byte UTF-8 character if the value is greater than 127.</strong></p>
  </blockquote>
  
  <p>So what does this mean?</p>
  
  <p>The code point of "ä" is E4 while the UTF-8 representation is C3A4, but neiter of those matches:</p>
  
  <pre><code>$t = 'ä'; // same as "\xC3\xA4";
  
  preg_match('/\\xC3A4/u', $t); // doesn't match
  preg_match('/\\x00E4/u', $t); // doesn't match
  </code></pre>
  
  <p>With the curly braces it does match when I give the code point:</p>
  
  <pre><code>preg_match('/\\x{00E4}/u', $t); // matches
  </code></pre>