This is not an answer to your posting, just an observation. Since
your script above is one of the significant solution to my earlier posting.
Thanks so much for your answer to my posting the other day.
In fact I also encounter the same problem you mentioned above. At times
that particular regex did not return the number-inserted strings.