I think \(
is always a capturing back reference. From what I can see from a few attempts, what you want is a \%(
, which is a non-capturing back reference.
So basically, rewriting your substitute as:
$s/.*\%(\d\\n\)\@<=\(";\)/\1
will put
";
to backreference \1
, rather than \2