* Chris Morris <chrismo / clabs.org> [Jan, 19 2004 20:50]:
> I need a re such that:
>
>  '  /* comment */  String s = "***/";  '.gsub(re, "*\\")
>
> returns:
>
>  '  /* comment *\  String s = "***/";  '
>
> I want to find all *\ instances that are not enclosed in double-quotes.
> Or is this one of those problems ill-suited for a regex?
there are better things, yes...

str.gsub!(/"[^"\\]*(\\.[^"\\]*)*"|\*\//){ |m| m == '\*' ? '*\\' : m }

will find strings and your pattern fast and efficient while avoiding
prematurely terminated strings (those that contain escaped quotes that
is),
	nikolai

--
::: name: Nikolai Weibull    :: aliases: pcp / lone-star / aka :::
::: born: Chicago, IL USA    :: loc atm: Gothenburg, Sweden    :::
::: page: www.pcppopper.org  :: fun atm: gf,lps,ruby,lisp,war3 :::
main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}