how to match 'space' symbol (and only space) in python2 regex?
<p>I am trying to use Python v2 (2.7.5 specifically) and the 're' module for regex matching. My problem is that for my application I need to match the 'space' symbol (i.e. 0x20 in hex) and ONLY that symbol as part of the match string. The first thing I tried for that was '\s' and that does not work because it also matches the newline, return, tab and form. </p>

<p>The end requirement is to match a string where the first three characters are digits ('\d'), there is a comma (',') and then eight symbols that are either digits ('\d') or spaces (???).</p>

<p>Any suggestions on how to do that? What I have already tried...</p>

<pre><code> C:\Users\jlaird&gt;python
 Python 2.7.5 (default, May 15 2013, 22:43:36) [MSC v.1500 32 bit (Intel)] on win32
 Type "help", "copyright", "credits" or "license" for more information.
 &gt;&gt;&gt; import re
 &gt;&gt;&gt; goodstring = '333,000000 2'
 &gt;&gt;&gt; badstring = '333,000000\t2'
 &gt;&gt;&gt; print badstring
 333,000000      2
 &gt;&gt;&gt; sRegex = '\d\d\d,[\s\d][\s\d][\s\d][\s\d][\s\d][\s\d][\s\d][\s\d]'
 &gt;&gt;&gt; cRegex = re.compile(sRegex)
 &gt;&gt;&gt; cRegex.match(goodstring)
 &lt;_sre.SRE_Match object at 0x023A7A30&gt;
 &gt;&gt;&gt; cRegex.match(badstring)
 &lt;_sre.SRE_Match object at 0x025E82C0&gt;
 &gt;&gt;&gt;
</code></pre>

<p>I want 'badstring' to evaluate to None because it has the tab character instead of the space. How can I do this?</p>