The given language is regular language (a+b)*
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
You may think that $n_{a}(P) = n_{b}(Q)$ requires comparison and for comparing them we need stack and stack +FA = PDA.
so it is not regular.
But here the thing is
We adjust the input string according to our requirement and divide them according to the need of the question such that
$n_{a}(P) = n_{b}(Q)$ condition satisfies.
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
For eg :-
1. aabbab is the input string.
we can divide the string like P = aab and Q = bab.
=> $n_{a}(P) = n_{b}(Q)$ = 2.
2. aaa is the input string.
we can divide the string like P = $\epsilon$ and Q = aaa.
=> $n_{a}(P) = n_{b}(Q)$ = 0.