LeDerp LeDerp - 4 months ago 12
Python Question

Python regex group search returns only the first match

I need to extract the contents of the numbered list. Please check the following url: https://regex101.com/r/oS0yT5/1

string = @BarsAndMelody #3thingsthatmakeyousmile #1) @livingleondre #2) Leondre and Charlie #3) chocolate ☺️

Answer

You need re.findall to find all the matches, not only the first:

string = "@BarsAndMelody #3thingsthatmakeyousmile #1) @livingleondre #2) Leondre and Charlie #3) chocolate  ☺️