I have the following text for example:
[ABC]something
foo 25
bar 20
[DEF]something
foo 50
.....and other similar text like this
I want to extract the three words from the brackets, foo and bar and the digits so i can get the result of re.findall as something like this
[('ABC', 'foo 25', bar 20'), ('DEF', 'foo 50')]
I tried the following pattern, but returns many empty strings in list
\[(\w+)\]|\n\s+(\w+\s\d+)