In article <20010504170408.B25737 / goldfinger.dgs.phony>, David S. <dgjs / acm.org> wrote: >On Sat, May 05, 2001 at 08:41:24AM +0900, Phil Tomson wrote: >> >> Apparently, the regex's in the srchStr create regex objects during the >> eval and those regex objects take a while to get cleared out by garbage >> collection and since there are many thousands of lines in the file being >> checked, the eval happens thousands of times (once on each line). It may >> be that on a larger file, I may need to do the GC.start after some number >> of lines in order to avoid running out of space. > >Wouldn't it be easier to compile the regular expression once before you >opent the file, then use the object's 'match' method at each line? > > srch_pat = Regex.compile("!(/Error Count = [1-9]/ || /Abort/ || /[1-9] >error/ || > /fatal/)") > ... > while (line = rpt_h.gets) do > if srch_pat(line) > failed = false > ... I'll try this, but I'm not hopeful that it'll work since "!(/Error Count = [1-9]/ || /Abort/ || /[1-9]error/ || > /fatal/)" is not really a regular expression, but a boolean formula that contains regular expressions. Phil