Skip to content

Tag: brackets

Extract string inside nested brackets

I need to extract strings from nested brackets like so: Result (Order doesn’t matter): Note, the string could have N brackets, and they will always be valid, but may or may not be nested. Also, the string doesn’t have to start with a bracket. The solutions I have found online to a similar problem …

Get the string within brackets in Python

I have a sample string <alpha.Customer[cus_Y4o9qMEZAugtnW] active_card=<alpha.AlphaObject[card] …>, created=1324336085, description=’Customer for My Test App’, livemode=False> I only want the value cus_Y4o9qMEZAugtnW and NOT card (which is inside another []) How could I do it in …