On the problem of obtaining capture groups by regular expressions

I now have a string 5900A7395900A7545900A414 . I want to divide this string into three separate strings 5900A739 , 5900A754 , and 5900A414 how can I use capture groups to implement the above requirements? Note that this is just an example, the actual situation is more complicated than this, the length of the same string is not fixed. For example, in the above example, the same string is 5900A , or it may be 5900A7 , and the length of the following different strings is not fixed. Could you tell me how to intercept a separate string?
has tried to capture groups himself, but can only capture fixed-length characters. Thank you in advance.


feel that you don't have to be regular, just find that common part to cut, and then see if the result is processed.

string = "5900A7395900A7545900A414"

tag = '59'

tmp_list = string.split(tag)

result = [''.join([tag, i]) for i in tmp_list if i != '']
print(result)    -sharp ['5900A739', '5900A754', '5900A414']

regular words, I am in the program employee toolbox-regular test this website test no problem, rewrite until the code result appears a number-do not know why 59.9%? (?! 59).) * test regular conditions, you can see for yourself to change

import re
string = "5900A7395900A7545900A414"
pattern = re.compile(r'(59.*?((?!59).)*)')
print(pattern.findall(string))
-sharp [('5900A739', '9'), ('5900A754', '4'), ('5900A414', '4')]

clipboard.png

Menu