Help with regexp in range in Ruby 1.8

Howdy,

I’ve got some code that looks like this:

 array_of_lines.each { |line|
    if line =~ /(?!st).*Soft\s+Error/../^Illegal\s+Request/
      ...
    end
 }

In Ruby 1.6.7 this code works as I’d expect … the body of the “if” is
executed for each group of lines ( and there are more than one) in the
array_of_lines that falls in the range.

Under Ruby 1.8 the “if” either fails after the first matching line
(that is the condition returns false for all lines but the first one in
the range), or, if I try variants, raises errors. I’ve tried:

 if (/(?!st).*Soft\s+Error/../^Illegal\s+Request/) =~ line
 if line =~ (/(?!st).*Soft\s+Error/../^Illegal\s+Request/)
 if (/(?!st).*Soft\s+Error/../^Illegal\s+Request/) === line

These variants all raise a "bad value for range (ArgumentError)"
exception.

How do I get back the functionality I had in 1.6.7?

Thanks in advance,

Jeff.

try

        if line =~ /(?!st).*Soft\s+Error/../^Illegal\s+Request/

          if line =~ /(?!st).*Soft\s+Error/ .. line =~ /^Illegal\s+Request/

How do I get back the functionality I had in 1.6.7?

but you'll have a warning with -w

Guy Decoux