re = /(?:^\d+.*\R)?(?:4-Diepi|5-Mts|.*\b(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\d{4}\b.*)$(*SKIP)(*F)|^\d+.*\R(\d+.*)$/m
str = 'Peie
71,176,953
T-re
71,173,557
5-Mts
41,653,495
45678
Sia
36,136,829
36,100,829
4-Diepi
120,829
uteCra
36,100
Oct2018'
# 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