I am trying to catch a repeated pattern in my string. The subpattern starts with the beginning of word or ":"
and ends with ":"
or end of word. I tried findall
and search
in combination of multiple matching ((subpattern)__(subpattern))+
but was not able what is wrong:
cc = "GT__abc23_1231:TF__XYZ451"
import regex
ma = regex.match("(\b|\:)([a-zA-Z]*)__(.*)(:|\b)", cc)
Expected output:
GT, abc23_1231, TF, XYZ451
I saw a bunch of questions like this, but it did not help.