Generating all words of length $n$ avoiding $A^2$ and $B^3$
Instead of constructing a regular expression, it is better to construct a DFA, or rather, a DFA with some "missing transitions". The DFA has the following states:


$q_0$: initial state.
$q_A$: state after seeing one A.
$q_B$: state after seeing one B.
$q_{BB}$: state after seeing two Bs.


The transition function is
$$
\begin{array}{c|cccc}
&amp; q_0 &amp; q_A &amp; q_B &amp; q_{BB} \\\hline
q_0 &amp; &amp; A &amp; B &amp; \\
q_A &amp; &amp; &amp; B &amp; \\
q_B &amp; &amp; A &amp; &amp; B \\
q_{BB} &amp; &amp; A &amp; &amp;
\end{array}
$$
This is read as follows: when at row $q$, upon reading $\sigma$, move to the appropriate column, if any. If there is no appropriate column, we have reached the (invisible) sink state.

Using this, it is not hard to see that the number of words of length $n$ in your language is
$$
\begin{pmatrix}
1 &amp; 0 &amp; 0 &amp; 0
\end{pmatrix}
\begin{pmatrix}
0 &amp; 1 &amp; 1 &amp; 0 \\
0 &amp; 0 &amp; 1 &amp; 0 \\
0 &amp; 1 &amp; 0 &amp; 1 \\
0 &amp; 1 &amp; 0 &amp; 0
\end{pmatrix}^n
\begin{pmatrix}
1 \\ 1 \\ 1 \\ 1
\end{pmatrix}.
$$
Calculation shows that for $n \geq 1$, the number of words of length $n$ in your language is
$$
\mathrm{round}(C \lambda^n), \text{where } C \approx 1.678735602594163 \text{ and } \lambda \approx 1.324717957244746.
$$
The eigenvalue $\lambda$ is also the unique real root of $x^3-x-1$.

A glance at the OEIS reveals that your sequence is A164001, and has the recurrence
$$
a_n =
\begin{cases}
n+1 &amp; n \leq 3, \\
a_{n-2} + a_{n-3} &amp; n \geq 4.
\end{cases}
$$
(The recurrence $a_n = a_{n-2} + a_{n-3}$ is of course related to the polynomial $x^3-x-1$ above.)