Help needed with Regexp Class

S

Sean Smitz

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
 
D

dblack

Hi --

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

--
Q. What is THE Ruby book for Rails developers?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
(See what readers are saying! http://www.rubypal.com/r4rrevs.pdf)
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)
 
S

Sean Smitz

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

Sean
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,235
Messages
2,571,181
Members
47,817
Latest member
BartHeckma

Latest Threads

Top