title: Cucumber Regex: How do I match a repeating pattern of comma separated value pairs?
body: <p>I have the following strings:</p>
  
  <pre><code>I submit the following values: username 'foo', password 'bar'
  I submit the following values: username 'foo', password 'bar','foo', profile 'bar', extra 'something'
  </code></pre>
  
  <p>I am trying to match the value pairs but I am not sure how I can repeat a pattern.</p>
  
  <p>So the result I want is:</p>
  
  <pre><code> username 'foo'
   password 'bar'
   ...
  </code></pre>
  
  <p>My regex so far:</p>
  
  <pre><code> I submit the following values: (\w+\s[^,]+),
  </code></pre>
  
  <p>I need to find a way to repeat the pattern and I also need to take care of the missing comma at the end. I am using the result in a Cucumber like testing framework for Python (freshen).</p>
  
  <p>The end result will be something like:</p>
  
  <pre><code>@When(r'I submit the following values: (\w+\s[^,]+), ...')
  def post_values_to_url(*args):
      post_dict = {}
      for pairs in args:
           #add values to dict
  
      response = client.get('this/is/a/url', post_dict)
  </code></pre>