Ruby is terser, and yet still very readable. In addition, you will not be getting any performance gain by using a JAVA regex over a ruby regex unless you are using a DFA implementation (if there is one for JAVA), in which case you won't get text capturing.
How many lines of Java code would it take you to read a file given on the command line and print out the prefixes of words ending in 'ing'
ARGF.readlines.each do |line|
puts m[1] if( m = line.match(/(\w+)(?:ing)$/) )
end
How many lines of Java code would it take you to read a file given on the command line and print out the prefixes of words ending in 'ing'
ARGF.readlines.each do |line| puts m[1] if( m = line.match(/(\w+)(?:ing)$/) ) end