From: Rick Bradley Date: 2002-05-08T02:18:16+09:00 Subject: Re: RegExp zero-width negative lookahead * Lars Christensen (larsch@cs.auc.dk) [020507 12:12]: > My current work-around is /([^x]|^)ox+o(?!x)/, but then I need to prepend > $1 to the replacement, e.g. > > str.gsub(/([^x]|^)ox+o(?!x)/) { $1 + "replacement" } > > .. and it gets even worse/impossible if one wants to non-match multiple > characters. If you can get a copy of Jeffrey Friedl's _Mastering_Regular_Expressions_ (O'Reilly) it might help significantly. He covers cases such as these (e.g., matching C and C++ comments while detecting single and double-quoted strings with \-escapes...) and much else in great detail. Rick -- http://www.rickbradley.com MUPRN: 919 (90 F) | has sky rocketed random email haiku | because I now can accept | credit card orders.