s = "This is an example where numbers 500 - 600 should not be captured separately. This is another example where numbers 500 to 600 should not be captured separately. This is an example where 600 should be captured."puts s.scan(/\d+ *(?:-|to) *\d+|\d+/)
Standard input is empty
500 - 600 500 to 600 600
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!