From: Brian Candler Date: 2007-03-24T05:34:29+09:00 Subject: Re: Knocking Lines Out Of A Multiline String On Sat, Mar 24, 2007 at 03:39:42AM +0900, Rick DeNatale wrote: > On 3/22/07, Robert Klemme wrote: > > >Bullshit: just use select: > > > > >> "foo\nbar\n".select {|l| /^f/ =~ l} > >=> ["foo\n"] > > Or, since he's really trying to exclude lines which include /usr/local/lib: > > str.reject {|s| Regexp.new("/usr/local/lib").match(s)} Why does nobody seem to anchor regexps? I have seen so many documentation examples now which suggest that something like raise "Invalid data" unless /[A-Za-z0-9]+/ =~ data is a good example of data validation :-( It would be a drift away from Perl, but I wonder if regexps should be anchored by default, and you'd have to add a flag to them to make them unanchored... Sorry, just my gripe of the day. Regards, Brian.