Let $m$ be the Lebesgue measure and the set $E$ be Lebesgue-measurable, and $m(E)<\infty$. Prove that for any $\epsilon>0$ there is a compactly supported continuous function $g:\mathbb{R} \to \mathbb{R}$ such thath $m(\{ x:\chi_E(x) \neq g(x)\})<\epsilon$
My attempt: We can define $E=\bigcup_{k=0}^n E_k$ where each $E_k$ has finite measure and they are disjoint and $n<\infty$.
By regularity of the Lebesgue measure, we know that $$m(E) = \sup \{m(K):K \text{ compact and }K\subset E\} $$
and for each $1\leq k \leq n$ then $\forall \epsilon/n > 0$, we have compact sets $F_k \subset E_k$, such that $m(E_k) < m(F_k) + \epsilon/n$, therefore $m(E_k-F_k) < \epsilon/n$
since each $E_k$ is disjoint
$$m \bigg(\bigcup_{k=1}^n (E_k - F_k)\bigg) = \sum_{k=1}^n(E_k-F_k) < \frac{\epsilon}{n}n = \epsilon$$
Define the function $g$
$$g = \begin{cases} 1 & x \in (a_k, b_k) \\ \frac{x+\delta_k-a_k}{\delta_k} & x\in[a_k - \delta_k, a_k] \\ \frac{-x + b_k+\delta_k}{\delta_k} & x \in [b_k, b_k + \delta_k] \\ 0 & \text{otherwise} \end{cases}$$
For each interval $E_k = [a_k, b_k]$ and arbitrary $\delta_k$ for each interval as well.