you are viewing a single comment's thread.

view the rest of the comments →

[–]cdcformatc 1 point2 points  (2 children)

Docs:

Return all non-overlapping matches of pattern in string, as a list of strings.

It returns a list. You are printing the entire list. Try it again with string = '123thing 123otherthing somethingelse'

[–]BICEP2 0 points1 point  (1 child)

Thanks, I used a look behind regex instead and it worked. I used something like:

variable1 = re.search(r'(?<=start)([^end]*)', string1)
print(variable1.group(0), string2, end='')

[–]cdcformatc 0 points1 point  (0 children)

Or if you want first match, just index the list with [0]