1. 从文本中读入字符串转换成一个一个的单词,再对这些单词进行匹配操作,将大写的单词挑出来。 ruby 代码 open('test.txt').read.split().each { |word| puts word if word =~ /^[A-Z]+$/ }