I’m trying to match this whole block and use it for further parsing.
This started from an example in Brian Merick’s book “Everyday
Scripting…” that had to be modified because amazon has changed their
presentation to tables instead of lists.
Anyway, the regex works fine as a single-line. as soon as I introduce
this:
"
testPit
something here
Best
"
it fails.
When I try this same expression with perl using the //s mode, it works.
I understand Ruby uses //m (multi-line mode in nearly the same fashion
causing newlines to be considered any character, so it should work,
right? Can anyone tell me what I am doing wrong here? Why isn’t
“multiline” mode working?
Thanks folks for all your help…turns out that I was using the regex
test view in Eclipse (RDT) which was obviously not behaving properly in
multi-line mode. I guess I need to go out and get the Aptana/Radrails
plugin that has the latest RDT and ruby-debug built in. I identified the
issue using Mike Lovitt’s Rubular regex tester. Thanks Mike for
restarting that server!
Thanks folks for all your help…turns out that I was using the regex
test view in Eclipse (RDT) which was obviously not behaving properly in
multi-line mode. I guess I need to go out and get the Aptana/Radrails
plugin that has the latest RDT and ruby-debug built in. I identified the
issue using Mike Lovitt’s Rubular regex tester. Thanks Mike for
restarting that server!
Thanks folks for all your help…turns out that I was using the regex
test view in Eclipse (RDT) which was obviously not behaving properly in
multi-line mode. I guess I need to go out and get the Aptana/Radrails
plugin that has the latest RDT and ruby-debug built in. I identified the
issue using Mike Lovitt’s Rubular regex tester. Thanks Mike for
restarting that server!
Why look so far? IRB serves the same purpose.
Cheers
robert
I’m a newb with Ruby and IRB. I did test the regex in IRB, but did not
know that I could set a literal string up with \n characters like you
did above through the interface. So, of course, it was passing
everytime. That is very cool! I am growing fonder of IRB every day…
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.