Or re.split
:
>>> import re
>>> s="[Guide] Strength (STR) is recommended on Warriors (Warriors -> Berserker)"
>>> result = re.split(r"\s+(?=[^()]*(?:\(|$))", s)
>>> next((i[1:-1] for i in result if i[0]=='(' and i[-1]==')'),'No sub-strings that are surrounded by parenthesis')
'STR'
>>>
Note: here if the strings does not contain any sub-string surrounded by parenthesis, it will Output 'No sub-strings that are surrounded by parenthesis'
, if that's not needed you can just do:
>>> next((i[1:-1] for i in result if i[0]=='(' and i[-1]==')'))
Or:
>>> [i[1:-1] for i in result if i[0]=='(' and i[-1]==')'][0]