re = /[78]([-* *\(*-*\(*\)*\d]{10})/
str = ' \'84951234567\', \'+74951234567\', \'8-495-1-234-567\',
\' 8 (8122) 56-56-56\', \'8-911-1234567\', \'8 (911) 12 345 67\',
\'8-911 12 345 67\', \'8 (911) - 123 - 45 - 67\', \'+ 7 999 123 4567\',
\'8 ( 999 ) 1234567\', \'8 999 123 4567\''
# 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