\(\frac{xy+2x-y-2}{xy-x-y+1}=\frac{\left(xy-y\right)+\left(2x-2\right)}{\left(xy-y\right)+\left(1-x\right)}\)
\(=\frac{\left(x-1\right)\left(y+2\right)}{\left(x-1\right)\left(y-1\right)}=\frac{y+2}{y-1}\)
\(\frac{\left(xy-y\right)+\left(2x-2\right)}{\left(xy-y\right)-\left(x-1\right)}=\frac{y\left(x-1\right)+2\left(x-1\right)}{y\left(x-1\right)-\left(x-1\right)}=\frac{\left(x-1\right)\left(y+2\right)}{\left(x-1\right)\left(y-1\right)}=\frac{y+2}{y-1}\)