  In this paper, we study a stochastic linear-quadratic control problem with
random coefficients and regime switching on a horizon $[0,T\wedge\tau]$, where
$\tau$ is a given random jump time for the underlying state process and $T$ is
a constant. We obtain an explicit optimal state feedback control and explicit
optimal cost value by solving a system of stochastic Riccati equations (SREs)
with jumps on $[0,T\wedge\tau]$. By the decomposition approach stemming from
filtration enlargement theory, we express the solution of the system of SREs
with jumps in terms of another system of SREs involving only Brownian
filtration on the deterministic horizon $[0,T]$. Solving the latter system is
the key theoretical contribution of this paper and we establish this for three
different cases, one of which seems to be new in the literature. These results
are then applied to study a mean-variance hedging problem with random
parameters that depend on both Brownian motion and Markov chain. The optimal
portfolio and optimal value are presented in closed forms with the aid of a
system of linear backward stochastic differential equations with jumps and
unbounded coefficients in addition to the SREs with jumps.
