# How is $L$ = {${ a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 }$} a regular language? [duplicate]

My understanding is that a machine with finite states cannot keep track of the n's being the same in $L$ = {${ a^nsb^n : s \in L(a^*b^*) ,\ n \ge 1 }$}, similar to the case with how $a^nb^n$ is not a regular language. For instance, if we take a string $aaaa ab bb$, where the fifth a and the following b are $s$, how is this valid? We have a disproportionate amount of a's to b's. Using the pumping lemma, I feel that this is disproven easily if $y$ (from $xyz$ division) is any number of a's at the beginning.

If this can be proven using a DFA, what is it?

You don't need to "keep track of $n$ being the same." Another way to write the language is
$$L = \{a^na^ib^jb^n\mid n\geq 1,\ i,j\geq 0\}=\{a^{n+i}b^{j+n}\mid n\geq 1,\ i,j\geq 0\}\,.$$
So, now, given a string $a^sb^t$, you just need to decide if you can choose $n\geq1$ and $i,j\geq 0$ such that $s=n+i$ and $t=n+j$. If so, then $a^sb^t\in L$; otherwise, $a^sb^t\notin L$. If $s=0$ or $t=0$, we can't choose $n$, $i$ and $j$ as required, since $n\geq 1$. However, as long as $s>0$ and $t>0$, we can take $n=1$, $i=s-1$ and $j=t-1$. Therefore,
$$L = \{a^sb^t\mid s,t\geq 1\}\,,$$
which is the language matched by the regular expression $aa^*b^*b$.