From: Lars Christensen Date: 2002-05-07T23:33:50+09:00 Subject: RegExp zero-width negative lookahead Hi, 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? -- Lars Christensen