Lol. I did have to ask recently about that bb.encode once I saw that it failed with 0's. Was wondering why I was getting weird results on a few posts. They also mentioned not using regex and also about regsubex.
Anyhow, after fixing the 0 problem (adding != $null to the while loop), it's working perfectly, so I can't complain.