From: Michael McDaniel Date: 2002-04-11T03:14:04+09:00 Subject: Re: regex: how to negate sequences? Michael McDaniel wrote: > Tobias Reif wrote: > >> Hi, >> >> In >> '-f-o>o-bar-->' >> , I need to match the string before >> --> >> , which is >> -f-o>o-bar >> How to? >> >> irb(main):009:0> '-f-o>o-bar-->' =~ /[^-->]+/ ; puts $& >> f >> nil >> >> I know why the above doesn't work, but I don't know how to negate a >> sequence of characters, instead of negating sets/collections. >> >> Tobi >> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > one way for this specific case... > > irb(main):006:0> /-->/.match("-f-o>o-bar-->").pre_match > "-f-o>o-bar" > irb(main):007:0> > > ~mm ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ I am looking at the post in KNode on KDE (SuSE Linux rel7.3) and the enclosing slashes '/' have disappeared from around '-->'; however, now in this reply I see them again! ~mm