Simplest way to explain will be I have this code,
Str = 'Floor_Live_Patterened_SpanPairs_1: [[-3, 0, 0, 5.5], [-3, 5.5, 0, 9.5]]Floor_Live_Patterened_SpanPairs_2: [[-3, 0, 0, 5.5], [-3, 9.5, 0, 13.5]]Floor_Live_Patterened_SpanPairs_3: [[-3, 5.5, 0, 9.5], [-3, 9.5, 0, 13.5]]'
from re import findall
findall ('[^\]\]]+\]\]?', Str)
What I get is,
['Floor_Live_Patterened_SpanPairs_1: [[-3, 0, 0, 5.5]',
', [-3, 5.5, 0, 9.5]]',
'Floor_Live_Patterened_SpanPairs_2: [[-3, 0, 0, 5.5]',
', [-3, 9.5, 0, 13.5]]',
'Floor_Live_Patterened_SpanPairs_3: [[-3, 5.5, 0, 9.5]',
', [-3, 9.5, 0, 13.5]]']
I assume it's taking only single ']' instead of ']]' when splitting, I want result as below,
['Floor_Live_Patterened_SpanPairs_1: [[-3, 0, 0, 5.5], [-3, 5.5, 0, 9.5]]',
'Floor_Live_Patterened_SpanPairs_2: [[-3, 0, 0, 5.5], [-3, 9.5, 0, 13.5]]',
'Floor_Live_Patterened_SpanPairs_3: [[-3, 5.5, 0, 9.5], [-3, 9.5, 0, 13.5]]']
I have gone through the documentation but couldn't work out how to achieve this or what modification should be done in above using regex findall function, a similar technique was adopted in one of answers in In Python, how do I split a string and keep the separators?