Yes, I use regex in my apps too. But only for simple string patterns. Something like multi line codes is out of my capacity. That's why I went for loops.
Sorry about being facetious - I actually will help when I can get to my PC so I can test any code I suggest. Currently existing on my Andoid tablet whilst on holiday. Another week or so before we head for home.