STDIN.read.split("\n").each do |nextline| if nextline =~ /^.+\/(.+)\/.+\/?$/ printf("matched %s in %s\n", $~[1], nextline); else puts "no match" endend
http://w...content-available-to-author-only...e.com/value/1234/different-value http://w...content-available-to-author-only...e.com/value/1234/different-value/
matched 1234 in http://w...content-available-to-author-only...e.com/value/1234/different-value matched 1234 in http://w...content-available-to-author-only...e.com/value/1234/different-value/
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!