<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
| hi
| i wish to find an reg exp for matching nested parenthesis of varying
| level like
| string =
| "somewords1(words(somewords2)-(some(some)words3)somestuff)somestuff"
| and be able to evaluate the pair starting from the inner most(the
| deepest level) , ie (some)
| up till the outer most. What is a good reg exp to do this? or is simple
| string manipulations enough?
| thanks

The presence of indefinitely nested fence markers, like parens, 
differentiates a context-free language, generated from a context-free 
grammar, from a regular language/grammar.  You cannot parse such sentences 
with a regex engine or even with an extended regex engine such as Python's. 
Use a more general parser.

tjr



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to