string1 = "abcdbcdbcde"
I want to extract string1 into three parts: (first part and third part can be empty string)
first part: a
second part (repeitions of some string): bcdbcdbcd
third part: e
import re
string1 = "abcdbcdbcde"
m = re.match("(.*)(.+){2,}(.*)", string1)
print m.groups()[0], m.groups()[1], m.groups()[2]
Of cuz, the code above doesn't work.
As I know, parentheses operator can be used as RegEx capturing group or reference to the pattern. How to use the parentheses operator in these 2 cases at the same time?
What I want:
m.groups()[0] = "a"
m.groups()[1] = "bcdbcdbcd"
m.groups()[2] = "e"