echo '@code_temp_table_$value_table'| sed -r "s/\@code/${input}/; /^(nz|sa)_/s/\\\$value_/\$value1_/"
Within double quotes, you need to escape both the \ and the $ character, to protect them from the shell, so that sed "sees" \$ in the regex part of the s command.
Also, you need single quotes for the echo statement, or escape the $ sign :
Indeed \| is a GNU extension to Basic Regular Expressions ( BRE ), as are \? and \+ . But I do not see a use for them, since GNU utilities also support at least Extended Regular Expressions (ERE) which supports |? and + , with the -E option for GNU grep (as with any grep) and the -r option for sed.
Standard sed uses BRE and does not understand ERE, nor the GNU extensions to BRE.
BSD sed has a -E option for ERE, but does not understand the GNU extensions to BRE
Any standard grep does support -E for ERE, but not the GNU extensions to BRE.
The drawback of ERE is that officially it does not support back reference, but the GNU and BSD versions do.