title: A pattern to match until "::" not working with string.gsub
body: <p>I'm trying to match any if statement ending with ::, and replace it with 'if (condition) then'.</p>
  
  <p>For example:</p>
  
  <pre><code>if (x) ::  
  </code></pre>
  
  <p>should be replaced with </p>
  
  <pre><code>if (x) then
  </code></pre>
  
  <p>I'm using <code>string.gsub</code> to achieve this, but it seems that my pattern isn't correct.  The following code only matches one if statement, but I want it to match all of them.</p>
  
  <pre><code>local code = [[
  
      if (x) ::
  
      end
  
      if (y) ::
  
      end
  
  ]]
  
  print(code:gsub("(if.+)::", "%1 then"))
  
  --[[
    what I wanted:
  
    if (x) then
  
    end
  
    if (y) then
  
    end
  
  
  
    what I got:
  
    if (x) ::
  
    end
  
    if (y) then
  
    end
  ]]
  </code></pre>
  
  <p>I'm not sure what I'm doing wrong.  Can anyone help?</p>