From: nobu.nokada@... Date: 2002-05-08T00:26:13+09:00 Subject: Re: RegExp zero-width negative lookahead Hi, At Tue, 7 May 2002 23:33:50 +0900, Lars Christensen wrote: > I'm puzzled why this doesn't work the way I expect it to. > > "xxoxxxoxx" =~ /(?!x)ox+o(?!x)/ #=> nil (ok) > "xx oxxxoxx" =~ /(?!x)ox+o(?!x)/ #=> nil (ok) > "xx oxxxo xx" =~ /(?!x)ox+o(?!x)/ #=> 3 (ok) > "xxoxxxo xx" =~ /(?!x)ox+o(?!x)/ #=> 2 (huh!?) > > Why is the string matched in the last case? Already pointed out the reason, however you really want look behind? "xxoxxxo xx" =~ /(? nil (with Oniguruma) -- Nobu Nakada