Forum: Ruby Help needed with Regexp Class

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
94d5a6d9277f30f1b8f34ffd4f74dc28?d=identicon&s=25 Sean Smitz (seans)
on 2007-03-05 02:17
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
1fba4539b6cafe2e60a2916fa184fc2f?d=identicon&s=25 unknown (Guest)
on 2007-03-05 02:39
(Received via mailing list)
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
94d5a6d9277f30f1b8f34ffd4f74dc28?d=identicon&s=25 Sean Smitz (seans)
on 2007-03-05 02:46
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
This topic is locked and can not be replied to.