This is a multi-part message in MIME format. ------ extPart_000_021B_01C0ED75.20F00010 Content-Type: text/plain; charset so-8859-1" Content-Transfer-Encoding: quoted-printable Is this normal? It looks like $& ends up being a hungry match, but not the String#scan result. irb> a = "aaa \"\\\"hello\\\"\"zzz" "aaa \"\\\"hello\\\"\"zzz" irb>regex = /"(\\"|[^"])*"/ /"(\\"|[^"])*"/ irb> irb> a.scan(regex) [["\\\""]] # this is strange result - $& is what I expected in some way in result irb> print $& "\"hello\""nil Wayne Wayne ------ extPart_000_021B_01C0ED75.20F00010 Content-Type: text/html; charset so-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META http-equiv=Content-Type content="text/html; charset=iso-8859-1"> <META content="MSHTML 5.50.4611.1300" name=GENERATOR> <STYLE></STYLE> </HEAD> <BODY bgColor=#ffffff> <DIV><FONT face=Arial size=2>Is this normal? It looks like $& ends up being a hungry match, but not the String#scan result.</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>irb> a = "aaa \"<A>\\\"hello\\\"\"zzz</A>"<BR>"aaa \"<A>\\\"hello\\\"\"zzz</A>"<BR>irb>regex = /"(<A href='file://\\"|[^"])*"/'>\\"|[^"])*"/</A><BR>/"(<A href='file://\\"|[^"])*"/'>\\"|[^"])*"/</A><BR>irb><BR>irb> a.scan(regex)<BR>[["<A>\\\</A>""]] # this is strange result - $& is what I expected in some way in result<BR>irb> print $&<BR>"\"hello\""nil</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Wayne</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2>Wayne</FONT></DIV> <DIV><FONT face=Arial size=2></FONT> </DIV> <DIV><FONT face=Arial size=2></FONT> </DIV></BODY></HTML> ------ extPart_000_021B_01C0ED75.20F00010--