SyntaxFix
Write A Post
Hire A Developer
Questions
You can also use
re.findall(r"\[([A-Za-z0-9_]+)\]", string)
if there are many occurrences that you would like to find.
See also for more info: How can I find all matches to a regular expression in Python?