title: Trim unicode whitespaces PHP
body: <p>I'm trying to trim unicode whitespaces such as this <a href="https://gist.github.com/Dethnull/9613129#file-portable-utf8-L1271" rel="nofollow noreferrer">characters</a> and I was able to do that using this <a href="https://stackoverflow.com/questions/4166896/trim-unicode-whitespace-in-php-5-2">solution</a>.. The problem with this solution is that it doesn't trim the unicode whitespaces IN BETWEEN normal characters..For example with this one using <a href="https://www.compart.com/en/unicode/U+2009" rel="nofollow noreferrer">Thin Space</a></p>
  <pre><code>$string = &quot;   test   string   &quot;;
  echo preg_replace('/^[\pZ\pC]+|[\pZ\pC]+$/u', '', $string);
  // outputs: test   string
  </code></pre>
  <p>I have a small understanding about RegEx so I don't know what to alter on my expression to resolve this issue</p>