From: Sathya Levy Date: 2012-01-27T07:15:34+09:00 Subject: Help with back references in regex Amatuer programmer here, just need some help inserting a * between a coefficient and a variable to later be evaled. Need some help referencing back to the (\d+) the number in front of a variable. Also need to do this with )( inserting a * in between them. Any help would be great. equation = "5x" if equation =~ /(\d+)x/ equation =equation.gsub((/(\d+)x/),(\1 + "*" + "x")) end -- Posted via http://www.ruby-forum.com/.