; matches the ";"
your second capture group (.+) matches "<space>x"
the \2 matches "<space>x"
Now we repeat the first capture group but this time match "<space>y" for both
there aren't any characters left, so the $ matches the empty string at the end.
Does that make sense? I haven't used sed in a little while.