title: Boost spirit parsing string with leading and trailing whitespace
body: <p>I am still new to Boost spirit. </p>
  
  <p>I am trying to parse a string with possible lead and trailing whitespace and intermediate whitespace. I want to do the following with the string</p>
  
  <ol>
  <li>Remove any trailing and leading whitespace</li>
  <li>Limit the in-between word spaces to one whitespace</li>
  </ol>
  
  <p>For example</p>
  
  <pre><code>"(  my   test1  ) (my  test2)"
  </code></pre>
  
  <p>gets parsed as two terms - </p>
  
  <pre><code>"my test1" 
  "my test2"
  </code></pre>
  
  <p>I have used the following logic </p>
  
  <pre><code>using boost::spirit::qi;
  struct Parser : grammar&lt;Iterator, attribType(), space_type&gt;
  {
     public:
       Parser() : Parser::base_type(term)
       {
           group  %= '(' &gt;&gt; (group | names) &gt;&gt; ')';
           names %= no_skip[alnum][_val=_1];
       }
  
    private:
      typedef boost::spirit::qi::rule&lt;Iterator, attribType(), space_type&gt; Rule;
      Rule group;
      Rule names
  }
  </code></pre>
  
  <p>While it allows preserving the spaces in between. Unfortunately, it also keeps heading and trailing whitespace and multiple intermediate whitespace. I want to find a better logic for that.</p>
  
  <p>I did see references to using a custom skipper with boost::spirit::qi::skip online, but I haven't come across a useful example for spaces. Does anyone else have experience with it?</p>