Let $p\geqslant 1$ (the period) be such that $N=p\,r$ for some $r$. And let $t$ be a bit-string with $|t|=p$. Then, to generate the bit-string $t^r$ from some bit-string $s$ requires $d(s,t)=\sum_{i=1}^N|s_i-t_{i\; \bmod\; p}|$ bits to be flipped.
So the number of regular strings with period $p$ that can be generated by flipping no more than $M\,$ bits of $s$ is $R(s,p)=\#\{\;t\;:\;|t|=p\;\; \wedge\;\; d(s,t)\leqslant M \;\}.$ Note that this also counts regular strings with periods that are factors of $p$, so the total number of regular strings that can be generated by flipping no more than $M\,$ bits of $s$ is $T(s)=\sum_{p
The calculation of $d(s,t)$ can be optimised by pre-analysing $s$. For $1\leqslant i\leqslant p$, let
$e_i(s,p)=\sum_{j=0}^{r-1}s_{jp+i}$
be the number of $1$-bits in $s$ at position $i$ in the period. To generate a $0$-bit at each position $i$ in the period, $e_i(s,p)$ bits would need flipping at that position, and to generate a $1$-bit, $r-e_i(s,p)$ bits would need flipping. This gives us a faster way of calculating $d(s,t)$: $d(s,t)=\sum_{i=1}^pe_i(s,p)+t_i(r-2e_i(s,p)).$
More sophisticated analysis of the $e_i(s,p)$ values would avoid the need to loop through all possible patterns for each period size to get $R(s,p)$.
Obviously if $\sum_{i=1}^p\textrm{min}\big(e_i(s,p),r-e_i(s,p)\big)>M,$ then no regular strings with period $p$ can be generated.