re = /(\d){1}\t\t(\d){1,3}\%\s\t(\d){1}\t(\d){1,3}\%/
str = 'Current car character
Power Handling Acceleration
102 107 104
Car character points history
Car part Level Action Wear New level New wear
Chassis: 6 96% 6 96%
Engine: 7 100% 7 100%
Front wing: 8 70% 8 70%
Rear wing: 8 75% 8 75%
Underbody: 8 63% 8 63%
Sidepods: 8 91% 8 91%
Cooling: 8 80% 8 80%
Gearbox: 7 82% 7 82%
Brakes: 9 25% 9 25%
Suspension: 8 94% 8 94%
Electronics: 8 78% 8 78%
(\\d){1}\\t\\t(\\d){1,3}\\%\\s\\t(\\d){1}\\t(\\d){1,3}\\%'
# Print the match result
str.scan(re) do |match|
puts match.to_s
end
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html