On 3/23/07, Brian Candler <B.Candler / pobox.com> wrote:
> On Sat, Mar 24, 2007 at 03:39:42AM +0900, Rick DeNatale wrote:
> > On 3/22/07, Robert Klemme <shortcutter / googlemail.com> 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?

Well, the OP said "I would like to remove lines matching
/usr/local/lib from the multiline string:", no mention of at the start
of a line.

I did actually consider pointing out that he might have meant at the
beginning of each line, but he didn't so I didn't.
-- 
Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/