title: how do I handle dots (decimal points) in python parsley?
body: <p>I'm trying to parse the output of a linux ps fuxa output using the following code (I started with {3} for testing purposes and I realized the parsing was failing due to the decimal point. My objective is to find THE_PACKAGE):</p>
  
  <pre><code>import parsley
  
  x = parsley.makeGrammar("""                                                                                                                            
  anything_followed_by_a_space = &lt;anything+&gt; ws                                                                                                          
  rpm = anything_followed_by_a_space{3} &lt;anything+&gt;:name_of_the_rpm -&gt; (name_of_the_rpm)                                                                 
  """, {})
  print x("root     26250  0.0  0.0 108208  1380 ?        S    16:01   0:00                      \_ sh /opt/scripts/V1.0/utils/install.sh THE_PACKAGE").rpm()
  </code></pre>
  
  <p>the letterOrDigit approach is not working when it finds <code>0.0</code>.</p>
  
  <p>e.g.</p>
  
  <pre><code>root     26250  0.0  0.0 108208  1380 ?        S    16:01   0:00 ... 
  </code></pre>
  
  <p>the <code>anything</code> built-in rule doesn't work either, I'm getting this error:</p>
  
  <pre><code>Parse error at line 2, column 0: end of input. trail: [anything]
  </code></pre>
  
  <p>any ideas?</p>
  
  <p>-- UPDATE --</p>
  
  <p>I managed to make it work like this but it looks ugly, I wish I could simplify all the special-character-check with the <code>anything</code> rule:</p>
  
  <pre><code>x = parsley.makeGrammar("""
  a_dot = exactly('.')
  a_colon = exactly(':')
  a_question_mark = exactly('?') ws
  the_activation_engine_script = '\_ sh /opt/scripts/V1.0/utils/install.sh'
  anything_followed_by_a_space = &lt;letterOrDigit+&gt; ws|a_dot|a_question_mark|a_colon
  rpm = anything_followed_by_a_space{18} the_activation_engine_script ws &lt;anything+&gt;:name_of_the_rpm -&gt; (name_of_the_rpm)
  """, {})
  print x("root     26250  0.0  0.0 108208  1380 ?        S    16:01   0:00                      \_ sh /opt/scripts/V1.0/utils/install.sh THE_PACKAGE").rpm()
  </code></pre>
  
  <p>The output:</p>
  
  <pre><code>&gt;&gt;&gt; 
  THE_PACKAGE
  </code></pre>