Subj : Re: Regexp Bug? To : Phrogz From : Brendan Eich Date : Fri Feb 18 2005 03:44 pm Phrogz wrote: > OK, my apologies, thinking about it a lot more (and seeing the same > result in IE's JS engine and Ruby's), I see that it's probably not a > bug. The position after the period satisfies the negative lookahead and > the word boundary. Or as ECMA-262 Edition 3 puts it, "The form (?! Disjunction ) specifies a zero-width negative lookahead. In order for it to succeed, the pattern inside Disjunction must fail to match at the current position. The current position is not advanced before matching the sequel." > Feel free to ignore this thread, though as an OT item, can anyone > suggest a way to match what I want? (All 'global' identifiers.) Sure. One way is to use split: s = "foo.bar.x = jim.jam * 15 - whee"; r = /(?:^|[^.])\b([a-z_]\w*)/g; a = s.split(r); and use every odd index in a. Another is to use "lambda replace": s = "foo.bar.x = jim.jam * 15 - whee"; r = /(?:^|[^.])\b([a-z_]\w*)/g; a = []; s.replace(r, function (m, p) { a.push(p); }); /be .