Open in the Regex Tester. Log in to leave a comment. Sometimes, while working with Python strings, we can have a problem in which we need to extract the substrings between certain characters and can be brackets. The code above works but I am parsing based on the opening bracket only while I would like to parse based on both square brackets ( ) and make sure parsing element (ie ) also appears at the beginning of each line preceding the text it is associated with. If you have a long command that is nested in square brackets, put a backslash before the newline if you want to continue the command on another line. Mike Searcy 9/24/2014 3:06:23 PM. The nested square brackets are only needed if one of the parts of the intersection is negated. sample some another one Note: In my use case, brackets cannot be nested. Backreference \1 will contain the item to be match. This is an upstream change and would be hard to justify to push it that far up. [xyz] [a-c] A character set. The nested groups are read from left to right in the pattern, with the first capture group being the contents of the first parentheses group, etc. Looking at the JSON, you can't remove the inner square brackets: they define the collection under "service", and since that contains two elements you can't discard the enclosing square brackets without making the resulting JSON invalid and unreadable. For example: [[this]is] a new form. I have a string on the following format: this is a [sample] string with [some] special words. There is a string: ""res = sqr(if((a>b)&(ab)&(a