CFG where u has same number of 1s as v $$L=\{uv\in\{0,1,2\}^*\mid u\in\{0,1\}^*,v\in\{1,2\}^*, \text{ and }u\text{ has the same number of 1s as }v\}.$$

Here is my attempt solution, but it is not completely correct, any hint is appreciated
(not sure how I can ensure that $u$ and $v$ to have the same number of 1).

\begin{align} 
S &amp;\rightarrow S_l \mid S \mid S_r\\
S_l &amp;\rightarrow 0S_l \mid 1S_l \mid S_l0 \mid S_l1 \mid \varepsilon \\
S_r &amp;\rightarrow 1S_r \mid 2S_r \mid S_r1 \mid S_r2 \mid \varepsilon
\end{align}
The idea is to extract a pair of 1s one by one, so the key grammar is

\begin{align} 
S&amp;\rightarrow S_01S1S_2 \\
S&amp;\rightarrow S_0S_2
\end{align}

where $S_0$ represents $0^*$ and $S_2$ represents $2^*$.