When using regular expression inside title-formatting script (with $regexp() function) backreferences inside replacement string are evaluated after all scripting functions included in replacement are applied.
It makes performing replacements based on a content of backreferences impossible.
This doesn't apply to "Replace with regular expression" action! Action works as it's supposed to: first bacreferences are evaluated, then any existing scripting functions are applied.
Consider regular expression:
Input string: string
Regular expression: .+
Replacement: $if($eql($&,string),x,y)
Action applied to a field having "string" as content returns x while..
$regexp(string,string,$if($eql($&,string),x,y))
..returns y