re = /(\+91[\s-]\d{5}[\s-]\d{5})|(011[\s-]\d{8})|(\+91\d{2}[\s-]\d{8})|(^0\d{10})|(^[6-9]\d{9})|(91[\s-]\d{3,5}[\s-]\d{2,5}[\s-]\d{4})|(91[\s-]\d{5}[\s-]\d{5})|(91[\s-]\d{10})|(\d{4}[\s-]\d{4}[\s-]\d{3})/m
str = 'r1: (\\+91[\\s-]\\d{5}[\\s-]\\d{5})|(011[\\s-]\\d{8})|(\\+91\\d{2}[\\s-]\\d{8})|(^0\\d{10})|(^[6-9]\\d{9})|(91[\\s-]\\d{3,5}[\\s-]\\d{3,5}[\\s-]\\d{4})|(91[\\s-]\\d{5}[\\s-]\\d{5})|(91[\\s-]\\d{10})
+91-98600 27066 /
+91-73871 11066
011-29534999, 011-29532555, 011 47527999
+9133 24798066,
+9133 24483458/3459
08048620522
8046041848
91 124 392 3000
91-80884 00951
91-9821328595
91 9822015432
+91 033 2461 8212
+91 033 2461 8213
645+91-98600 270664684 /
6546+91-73871 11066656
011-29534999, 011-29532555, 011 47527999
+9133 24798066656,
+9133 24483458/3459
8048620522656
8046041848656
91 124 392 3000656
91-80884 00951656
91-9821328595656656
91 9822015432656
656+91 033 2461 8212
+91 033 2461 8213656
'
# 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