I'm going to provide a more algebraic explanation of the issue.
Every valid (and invalid) Bech32 string can be seen as a polynomial in the variable x, where the coefficients are elements of GF(32). I'm going to ignore the GF(32) part in what follows, so it suffices to say that they're simply numbers from 0 to 31 inclusive, with weird addition and ...
Pieter Wuille's comment gives a nice summary:
basically: take a bech32 string, xor a 1 into the last character, then push or pop as many 'q's as you like, and then xor a 1 into the last character again... should always give you a valid new bech32 string
Checksum code taken from Bitcoin Core is:
uint32_t PolyMod(const data& v)
uint32_t c = 1;
Regtest and testnet are different networks. They are not compatible with each other.
Regtest is a private local network which is used solely for testing. It is primarily used for the regression tests, hence the name regtest.
Testnet is the public testing network which is very similar to mainnet, the main network. It has a different genesis block and has ...