Help needed with Regexp Class


#1

I can not seem to get the Regexp::MULTILINE mode enabled for specific
Regexp objects. I’ve tried:

Regexp.new(expr, ‘m’)
Regexp.new(expr, ‘/m’)
Regexp.new(expr, Regexp::MULTILINE)

among others. What goes in the option field? Thanks in advance,

Sean


#2

Hi –

On Mon, 5 Mar 2007, Sean Smitz wrote:

I can not seem to get the Regexp::MULTILINE mode enabled for specific
Regexp objects. I’ve tried:

Regexp.new(expr, ‘m’)
Regexp.new(expr, ‘/m’)
Regexp.new(expr, Regexp::MULTILINE)

among others. What goes in the option field? Thanks in advance,

irb(main):001:0> Regexp.new(".", Regexp::MULTILINE)
=> /./m

If expr is itself a regex, then the multiline flag will be ignored,
but you should get a warning for that.

David


#3

Nevermind, I just tried Regexp::MULTILINE in there and this time it
worked… How very annoying. Thank you

Sean

irb(main):001:0> Regexp.new(".", Regexp::MULTILINE)
=> /./m

If expr is itself a regex, then the multiline flag will be ignored,
but you should get a warning for that.

David