11 Mar
2010
11 Mar
'10
4:45 p.m.
Eric J. Holtman wrote:
Shaolin wrote:
Hello Gevorg,
An example string: (4+1)*2 - I want to return true if the parentheses are found and false if there are none or there is a partial match ( e.g. (2+2+1 will return false because there is only one parenthese and hence the equation is incomplete).
You can't really do parathesis matching with regular expressions.
True, if there can be nesting of parentheses. Otherwise, you can search for parenthesized non-empty sub-expressions with "\\([^\\(\\)]+\\)" Regards, Gevorg