I'm trying to get a variable that cold be between the '[var]' or '[var["something"]]'.
Example no.1: If the string is: str = "[AgentStateTime]";
The output should be: AgentStateTime
Example no.2: If the string is: str = "[AgentStateTime["Break"]";
The output should be: AgentStateTime
What is the pattern that works for both?