From: "Nobuyoshi.Nakada" Date: 2001-01-17T10:38:39+09:00 Subject: [ruby-list:27215] Re: 検索パターンが更新されない。 なかだです。 At Wed, 17 Jan 2001 10:12:53 +0900 Katsuya Tanaka wrote: > そうすると、この /o の最初の一回というのは(ループ内とか、 > メゾット内とかじゃなくて)スクリプト全体でという意味に > なのでしょうか? そういうことです。特定のタイミングで正規表現を再コンパイルさせたければ、 Regexp.new を使います。 loop do date = Time.now.strftime("%Y/%m/%d"); + re = Regexp.new(Regexp::quote(date)) print "debug:", date,"\n"; begin fd = open("#{Basedir}/message", "r"); while line = fd.gets - next if ! /#{Regexp::quote(date)}/o; + next if re !~ line print line; end -- --- 僕の前にBugはない。 --- 僕の後ろにBugはできる。 中田 伸悦