From: Iain 'Spoon' Truskett Date: 2002-12-20T10:07:56+09:00 Subject: Re: regex help please please ! * Matthew, Graeme (Graeme.Matthew@mercer.com) [20 Dec 2002 11:49]: [...] > How does one do greedy regex's in ruby ? in Perl / Python one has > access to the /s or .DOTALL option but in ruby I cannot get a greedy > effect. That's not what 'greedy' means in regular expressions. You're thinking of 'multiline mode'. In Perl, that's /s In Ruby, that's /m (one day, someone will explain why Ruby has Perl's /m on by default and renamed /s to /m; feel free to make that day today) Greediness is that quantifiers grab as much as they can. e.g. /^.+/ matches all of "foo", not just "f" which /^.+?/ would match. irb(main):001:0> "foo" =~ /^.+?/; puts $& f => nil irb(main):002:0> "foo" =~ /^.+/; puts $& foo => nil cheers, -- Iain.