  Let $T(X)$ (resp. L(V)) be the semigroup of all transformations (resp. linear
transformations) of a set $X$ (resp. vector space $V$). For a subset $Y$ of $X$
and a subsemigroup $\mathbb{S}(Y)$ of $T(Y)$, consider the subsemigroup
$T_{\mathbb{S}(Y)}(X) = \{f\in T(X)\colon f_{\upharpoonright_Y} \in
\mathbb{S}(Y)\}$ of $T(X)$, where $f_{\upharpoonright_Y}\in T(Y)$ agrees with
$f$ on $Y$. We give a new characterization for $T_{\mathbb{S}(Y)}(X)$ to be a
regular semigroup [inverse semigroup]. For a subspace $W$ of $V$ and a
subsemigroup $\mathbb{S}(W)$ of $L(W)$, we define an analogous subsemigroup
$L_{\mathbb{S}(W)}(V) = \{f\in L(V) \colon f_{\upharpoonright_W} \in
\mathbb{S}(W)\}$ of $L(V)$. We describe regular elements in
$L_{\mathbb{S}(W)}(V)$ and determine when $L_{\mathbb{S}(W)}(V)$ is a regular
semigroup [inverse semigroup, completely regular semigroup]. If $\mathbb{S}(Y)$
(resp. $\mathbb{S}(W)$) contains the identity of $T(Y)$ (resp. $L(W)$), we
describe unit-regular elements in $T_{\mathbb{S}(Y)}(X)$ (resp.
$L_{\mathbb{S}(W)}(V)$) and determine when $T_{\mathbb{S}(Y)}(X)$ (resp.
$L_{\mathbb{S}(W)}(V)$) is a unit-regular semigroup.
