Multiline regular expression in Ruby 1.9
Here is a sample code for multiline regular expression in Ruby 1.9.
#!/usr/bin/ruby1.9 s = [0x01, 0x02, 0x03, 0x04, 0x0a, 0x0b, 0x0c].pack("C*") if s =~ %r!.{6}! puts 'match1' end if s =~ %r!.{6}!m puts 'match2' end
Result:
% ./multiline.rb match2
It works correctly, I think.