re = /^(\+){0,1}254(110|111|112|113|114|115|116|117|118|119|701|700|702|703|704|705|706|707|708|709|710|711|712|713|714|715|716|717|718|719|720|721|722|723|724|725|726|727|728|729|740|741|742|743|745|746|748|757|758|759|767|768|769|790|791|792|793|794|795|796|797|798|799)(\d{6})$/m
str = ''
# 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