From: Robert Dober Date: 2011-04-24T17:09:40+09:00 Subject: Re: How to split dot “.” only before equal “=” On Sun, Apr 24, 2011 at 9:33 AM, Robert Dober wrote: > On Sat, Apr 23, 2011 at 7:38 PM, Roy Zuo wrote: >> You need regex lookahead syntax >> >> ruby-1.9.2-head > str.split( /\.(?=[^=]*=)/ ) > actually the lookahead can be a little simpler here, (?=.*=) does the > trick, or did I miss any particular edge case you had in mind. Sorry I git confused below > Please note that [^=]*= can *always* be expressed as .*??= and often, With .*?? I meant (?>.*?)=, which is not really worth of replacing [^=]*= (but might come in handy if = were a complex subexpression). I am not so sure about *always* either as there might be further context which forces the .*? part to be too greedy, maybe. -- The 1,000,000th fibonacci number contains '42' 2039 times; that is almost 30 occurrences more than expected (208988 digits). N.B. The 42nd fibonacci number does not contain '1000000' that is almost the expected 3.0e-06 times.