When you use re.findall(“(.*):” to get the strings ending with full-colon(:), you may not always get the expected result if your string has multiple full-colons. Lets run the command before we talk.
Concentrate on the commands put inside single colon. (You can neglect the rest as it is part of my effort to avoid creating a python file for running this code)
What happened here is python did a greedy search and found maximum string ending with a full-colon. If that is what you desired, stop reading further.. 🙂
If you expected a list of all the strings ending with full-colon, change your command to re.findall(“(.*?):”
As you can see, I added a question mark which will force python to avoid greedy approach.
Before we part, lets make sure python is ok with this change..
Output: