This ruby program successfully prints all 5-letter words starting with
(in a text file containing all current U.S. English Scrabble words).
fp = File.open(‘C:\Documents and Settings\User\twl06FromMac.txt’)
fp.each do |line|
puts line if line =~ /^j…$/
I would like to allow the user to enter the regex rather than have it
hard-coded as above. I’ve tried to get eval to work after building a
string to pass it. No luck so far.
I’m positive this is easy in Ruby but currently it’s driving me nuts.