re = /^(?=\d* \d*$)0[1-9 ][\d ]{9,10}$/m
str = '0123 122222
00213123 21
123123 1233
09 12312333
0 1111111133
01234 555 523
08374873 8
08654654 654'
# 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