From: Wes Gamble Date: 2006-03-29T05:16:37+09:00 Subject: Re: Regexp to match strings that _don't_ being with a string Thanks, that makes sense since the lookahead doesn't "consume" right? WG Joel VanderWerf wrote: > Wes Gamble wrote: >> I have a new wrinkle. >> >> Now I want to match any line that doesn't have "xyz" or "abc" at the >> beginning of the line. >> >> Is there a way to "AND" together the input to the negative lookahead >> assertion? > > For lookaheads, you can get AND by concatenating: > > > irb(main):001:0> /^(?!abc)(?!xyz)/ =~ "abc" > => nil > irb(main):002:0> /^(?!abc)(?!xyz)/ =~ " abc" > => 0 > irb(main):003:0> /^(?!abc)(?!xyz)/ =~ "xyz" > => nil > irb(main):004:0> /^(?!abc)(?!xyz)/ =~ " xyz" > => 0 -- Posted via http://www.ruby-forum.com/.