Sed back referencing with Extended Regular Expressions
Answer #1 100 %Back-referencing in BRE: \(pattern\)
makes the sub-pattern and access with \n
Back-referencing in ERE: (pattern)
makes the sub-pattern and access with \n
Your sed command in ERE:
sed -r 's#(www[0-9]*\.)[a-zA-Z0-9._]*(\.domain\.com[a-zA-Z0-9._/]*)#\1subtituted_text.\2#g'