title: Regex to Match Horizontal White Spaces
body: <p>I need a regex in Python2 to match only horizontal white spaces not newlines.</p>
  <p><strong><code>\s</code></strong> matches all whitespaces including newlines.</p>
  <pre><code>&gt;&gt;&gt; re.sub(r&quot;\s&quot;, &quot;&quot;, &quot;line 1.\nline 2\n&quot;)
  'line1.line2'
  </code></pre>
  <p><strong><code>\h</code></strong> does not work at all.</p>
  <pre><code>&gt;&gt;&gt; re.sub(r&quot;\h&quot;, &quot;&quot;, &quot;line 1.\nline 2\n&quot;)
  'line 1.\nline 2\n'
  </code></pre>
  <p><strong><code>[\t ]</code></strong> works but I am not sure if I am missing other possible white space characters especially in Unicode. Such as <strong><code>\u00A0</code></strong> (non breaking space) or <strong><code>\u200A</code></strong> (hair space). There are much more white space characters at the following link: <a href="https://www.cs.tut.fi/%7Ejkorpela/chars/spaces.html" rel="nofollow noreferrer">https://www.cs.tut.fi/~jkorpela/chars/spaces.html</a> (dead link)</p>
  <pre><code>&gt;&gt;&gt; re.sub(r&quot;[\t ]&quot;, &quot;&quot;, u&quot;line 1.\nline 2\n\u00A0\u200A\n&quot;, flags=re.UNICODE)
  u'line1.\nline2\n\xa0\u200a\n'
  </code></pre>
  <p>Do you have any suggestions?</p>