I run the following code
sed 's/\([^ ]+\) your \([^ ]+\)/ \2\1er/' < fail
The file fail is
fail your test
The above command gives me
fail your test
although it should give "testfailer".
The second and first globs \2\1
should be at the start of the word "er".
This suggests me that the problem may be in the regexes in the search part.
However, they seem to be correct for me.
Do you see any mistake in the code?