title: Matching specific unicode char in haskell regexp
body: <p><strong>This is Mac/OSX related problem!</strong></p>
  
  <p>I have the following three character long haskell string:</p>
  
  <pre><code>"a\160b"
  </code></pre>
  
  <p>I want to match and replace the middle character</p>
  
  <p>Several approaches like</p>
  
  <pre><code>ghci&gt; :m +Text.Regex
  ghci&gt; subRegex (mkRegex "\160") "a\160b" "X"
    "*** Exception: user error (Text.Regex.Posix.String died: (ReturnCode 17,"illegal byte sequence"))
  ghci&gt; subRegex (mkRegex "\\160") "a\160b" "X"
    "a\160b"
  </code></pre>
  
  <p>did not yield the desired result.</p>
  
  <p>How do I have to modify the regexp or my environment to replace the '\160' with the 'X' ?</p>
  
  <p>The problem seems to have it's root in the locale/encoding of the input.</p>
  
  <pre><code>bash&gt; locale
  LANG=
  LC_COLLATE="C"
  LC_CTYPE="UTF-8"
  LC_MESSAGES="C"
  LC_MONETARY="C"
  LC_NUMERIC="C"
  LC_TIME="C"
  LC_ALL=
  </code></pre>
  
  <p>I already modified my .bashrc to export the following env-vars:</p>
  
  <pre><code>bash&gt; locale
  LANG="en_US.UTF-8"
  LC_COLLATE="en_US.UTF-8"
  LC_CTYPE="en_US.UTF-8"
  LC_MESSAGES="en_US.UTF-8"
  LC_MONETARY="en_US.UTF-8"
  LC_NUMERIC="en_US.UTF-8"
  LC_TIME="en_US.UTF-8"
  LC_ALL="en_US.UTF-8"
  </code></pre>
  
  <p>But this did not change the behavior at all.</p>