title: regex: stop matching when end of line
body: <p>I want to scan a text composed of lines. When I recognize a keyword I am using a regex for this type of line.</p>
  
  <p>My text has this form:</p>
  
  <pre><code>text&lt;eol&gt;
  ...
  Function1 parameter1 value1, parameter2 value2, .... parameterN value N&lt;eol&gt;
  ...
  text&lt;eol&gt;
  </code></pre>
  
  <p>In this case, when I recognize "Function1", I use this regex:</p>
  
  <pre><code>(?:(\w+)\s|\G(?&lt;!^))[ ]*(\S+[ ]+\S+)\s*,?
  
  $1 = the keyword Function1
  $3 = parameterx valuex
  </code></pre>
  
  <p>I would like to stop the matching when the end of line is found.</p>
  
  <pre><code>while mytext =~ /.../ do
   case $3
    when 'parameter1 value1'
     ...
   end #case
   $'
  end #while
  </code></pre>
  
  <p>My code is correct excepted when the matching is close to the end of line:my regex captures a part a the next line.</p>
  
  <p>The question is: what can I add in my regex to stop when end of line ?
  I suppose I must add $ somewhere ?  </p>
  
  <p><strong>Note:</strong>
  Sorry I copied the wrong regex ([] gave me an error with Ruby 2.0).
  Note the space before the first star !</p>
  
  <pre><code>(?:(\w+)(\s+)|\G(?&lt;!^)) *(\S+\s+\S+)\s*,?
  </code></pre>