#!/usr/bin/env ruby # coding: utf-8 print"検索パターン:" pattern = STDIN.gets.chomp! regexp = Regexp.new(pattern,nil) while line = gets if regexp =~ line print line end end