fork download
  1. re = /(select).*?(from)[\\r\\n]*/i
  2. str = 'SELECT\\r\\n money\\r\\nFROM\\r\\n accounts'
  3. subst = '\\1 count(*) \\2'
  4.  
  5. result = str.gsub(re, subst)
  6.  
  7. # Print the result of the substitution
  8. puts result
  9.  
Success #stdin #stdout 0.01s 5860KB
stdin
Standard input is empty
stdout
SELECT count(*) FROM accounts