re = /C(at){2,}/
str = 'Now we are looking for the pattern of a capital "C" followed by the letters "at" repeated two or more times.
This pattern will not match "Cat" since the "at" is not repeated.
It will match the first five letters of "Catatonic" since that fits our pattern.
It will not match "catatonic" because the "c" is not capitalized.'
# 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