How to compute the measure induced by a linear functional The Riesz representation theorem states that for any linear functional $\varphi\in (C_0(K))^*$ there exists a regular complex Borel measure $\mu$ such that
$$
\varphi(f)=\int fd\mu,\ \ \forall f\in C_0(K).
$$
I would like to compute, for a Borel set $E\subset K$, the measure $\mu(E)$, not explicitily, but in terms of $\varphi$. I know that
$$
    \mu(E)=\int \chi_Ed\mu,
$$
but it is not necessarily true that $\chi_E\in C_0(K)$. So I could try to approximate $\chi_E$ by continuous functions $f\in C_0(K)$ such that $Imf\subset[0,1]$.

Define $\mathcal I=\{L: L\subset E\mbox{ and $L$ is compact}\}$. Then $\mathcal I$ is a directed set, if we equip it with the order "$\subset$". Also define $\mathcal J=\{U: E\subset U\mbox{ and $L$ is open}\}$. This is a directed set, if we equip it with the order "$\supset$". Then, the set $\mathcal I\times\mathcal J$ equipped with the order
$$
(L,U)\leq(L',U') \Leftrightarrow L\subset L'\mbox{ or }(L\not\subset L'\mbox{ and }U\supset U'),
$$ 
is a directed set.

For each $(L,U)\in\mathcal I\times\mathcal J$, we have that $L\subset U$ and, using Urysohn's Lemma, I may fix a function $f_{(L,U)}$ such that
$$
   Im f_{(L,U)}\subset[0,1],\ f_{(L,U)}|_{L}\equiv1\ \mbox{ and }\ f_{(L,U)}|_{U^c}\equiv0,
$$
and consider the net $(f_{(L,U)})_{(L,U)\in\mathcal I\times\mathcal J}$.

It is easy to check that $\chi_{L}\leq f_{(L,U)} \leq \chi_U$. Suppose that $\mu$ is positive measure, then it follows that
$$
\mu(L)\leq \int f_{(L,U)}d\mu = \varphi\left(f_{(L,U)}\right) \leq \mu(U),\ \ \forall (L,U)\in\mathcal I\times\mathcal J.
$$
Since $\mu$ is regular,
$$
\mu(E)=\sup\{\mu(L):L\in\mathcal I\} = \inf\{\mu(U):U\in\mathcal J\}.
$$
Then, by doing some boring calculations, we get that
$$
\liminf_{(L,U) \in \mathcal I\times\mathcal J} \varphi\left(f_{(L,U)}\right) \geq \sup\{\mu(L):L\in\mathcal I\} = \mu(E),
$$
and
$$
\limsup_{(L,U) \in \mathcal I\times\mathcal J} \varphi\left(f_{(L,U)}\right) \leq \inf\{\mu(U):U\in\mathcal J\} = \mu(E).
$$
Therefore,
$$
\lim_{(L,U) \in \mathcal I\times\mathcal J} \varphi\left(f_{(L,U)}\right)=\mu(E).
$$
So this is true when $\mu$ is positive. But we may obtain a decomposition $\mu = (\mu_r^+-\mu_r^-)+i(\mu_i^+-\mu_i^-)$, with $\mu_r^\pm$ and $\mu_i^\pm$ positive measures, so this result follows for the general case.

My question is: Is this right?
That's the right idea.   You can approximate it as well as you would like as follows: for a given $\varepsilon&gt;0$ use regularity to obtain an open set $U$ and a compact set $K$ with $K\subset E\subset U$ and 
$$\mu(U)-\varepsilon&lt;\mu(E)&lt;\mu(K)+\varepsilon.$$
 (Or apply regularity for positive and negative variations of the real and imaginary parts of $\mu$ if it is complex, and vary the $\varepsilon$ in the above expression accordingly) and use Urysohn to obtain a continuous $f$ with $\chi_{K}\leq f\leq \chi_{U}$, and thus $|\mu(E)-\int f\ d\mu|&lt;\varepsilon$.

I found one small error: in the line 
$$Im f_{(L,U)}\subset[0,1],\ f_{(L,U)}|_{L}\equiv1\ \mbox{ and }\ f_{(L,U)}|_{U}\equiv0,$$
it should be $f_{(L,U)}|_{U^c}\equiv0$.
That's the right idea.   You can approximate it as well as you would like as follows: for a given $\varepsilon&gt;0$ use regularity to obtain an open set $U$ and a compact set $K$ with $K\subset E\subset U$ and 
$$\mu(U)-\varepsilon&lt;\mu(E)&lt;\mu(K)+\varepsilon.$$
 (Or apply regularity for positive and negative variations of the real and imaginary parts of $\mu$ if it is complex, and vary the $\varepsilon$ in the above expression accordingly) and use Urysohn to obtain a continuous $f$ with $\chi_{K}\leq f\leq \chi_{U}$, and thus $|\mu(E)-\int f\ d\mu|&lt;\varepsilon$.

I found one small error: in the line 
$$Im f_{(L,U)}\subset[0,1],\ f_{(L,U)}|_{L}\equiv1\ \mbox{ and }\ f_{(L,U)}|_{U}\equiv0,$$
it should be $f_{(L,U)}|_{U^c}\equiv0$.