From: Brian Candler Date: 2009-08-18T19:22:40+09:00 Subject: Re: unit testing generated content sylvain wrote: > What I would like to do now, is to have a regexp assert multiline > match, some thing like : > > assert_match_regexp(actual) { > /^start/ > /something .*/ > /^\s*$/ > /^end/ > } > > Which mean I expect 4 lines, individually matching the associated > regexp You can match a single regexp across a multi-line string; using /m option is clearer since . then matches any character including newline. >> str = "foo\nbar\nbaz\nbap\n" => "foo\nbar\nbaz\nbap\n" >> str =~ /^bar$\n^baz$\n^bap$/m => 4 >> str =~ /^bar$.*^bap$/m => 4 -- Posted via http://www.ruby-forum.com/.