From: dblack@... Date: 2002-12-06T11:59:12+09:00 Subject: Re: Regexp imxo - does 'x' work? Hi -- On Fri, 6 Dec 2002, ahoward wrote: > On Fri, 6 Dec 2002 dblack@candle.superlink.net wrote: > > [snip] > D> > should this not work ? > D> > > D> > irb(main):001:0> %r{ > D> > irb(main):002:0/ foo > D> > irb(main):003:0/ #foo > D> > irb(main):004:0/ bar > D> > irb(main):005:0/ #bar > D> > irb(main):006:0/ } > D> > /\nfoo\n#foo\nbar\n#bar\n/ > D> > D> That's working, isn't it? > [snip] > > i guess. it looked like the comments were being included in the regex... i > guess they are not. Oh, I see what you mean -- but yes, they are included. Hmmm... I was going to say, use a literal instead of %r{} to get the comments in, but that seems not to be available: ruby -e 'p /abc #blah /x' /abc\n#blah\n/x > since ruby's comments continue till line's end, i guess there is no > way to embed comments in a single line regex? or is there? All I can think of is: irb(main):003:0> /ab#{"This is a comment"*0}c/.match("abc") # :-) David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav