Cio ibykos, grazie della risposta.

Sì, è vero che è un problema ricorsivo, ma è anche vero che (almeno a quanto ho letto in giro) alcune implementazioni permettono anche regexp ricorsive (presumo il perl)

Qui ho trovato il principio, poi googlando un pò si dovrebbe trovare il resto.

La regex (tratto dal link prima) è la seguente:

codice:
^((?:[^()]|\((?1)\))*+)$

Con la spiegazione:
codice:
^             Beginning of the string
(             Start the "balanced substring" group (to be called recursively)
  (?:         Start the "minimal balanced substring" group
    [^()]     Minimal balanced substring is either a non-paren character
    |         or
    \((?1)\)  a set of parens containing a balanced substring
  )           Finish the "minimal balanced substring" group
  *           Our balanced substring is a maximal sequence of minimal
              balanced substrings
  +           Don't backtrack once we've matched a maximal sequence
)             Finish the "balanced substring" pattern
$             End of the string