I'm currently using pyparsing to identify whether a nested parenthesis is being used in a string, in order to identify reference numbers being mistakenly concatenated to words.
For instance, 'apple(4)'.
I want to be able to identify the reference subtoken ('(4)'). However, when I use searchString, it returns a ParseResults object of [[7]], which doesn't provide the parenthesis. I want to find the substring in the original token, so I need to have the nest characters included in the ParseResults object. Ie, I want to search for '(4)'. Is there a way to make searchString return the nest characters.
nestedExpris a quick-and-dirty helper to quickly jump over nested parens, braces, brackets, etc., preserving the structure from the nesting. If you just want the raw substring, wrapnestedExprinoriginalTextFor, which should include the enclosing()'s. But if you really want to make sense of the contents, then I'd suggest you define actual recursive expressions for them.