/
(?(DEFINE)
(?<palindrome>
# Recursive alternative first to match recursive palindromes.
# Invert alternatives order to match nested palindromes individually
# and (drastically) reduce backtracking.
(?<l1>\p{L})\p{M}* [\s\p{P}]* (?&palindrome) [\s\p{P}]* \k<l1>\p{M}*
| (?<l2>\p{L})\p{M}* [\s\p{P}]* \k<l2>\p{M}*
| \p{L}\p{M}*