import re
# ----------------------------------------------------------------
# ---- search a string for a sub-string
# ----------------------------------------------------------------
def search_for_substr(regx,srcstr):
print()
print(f"searching for '{srcstr}'")
res = re.search(regx,srcstr)
# ---- find anything?
if not res:
return (False,0,0,None)
# ---- get search results
start = res.start()
end = res.end()
substr = srcstr[start:end]
return (True,start,end,substr)
# ----------------------------------------------------------------
# ---- main
# ----------------------------------------------------------------
while True:
tf,start,end,substr = search_for_substr(REGX,string_to_search)
if tf is not True: break
print(f'found {substr}')
string_to_search = string_to_search[end:]