jones jones - 1 year ago 79
PHP Question

How to get string between the last nested `(` , and `)`?

I have some MySQL statement like below:

GROUP_CONCAT(CONCAT_WS("=",DATE_FORMAT(ca.`date`,'%Y-%m-%d'),sa.`precence`)) as attendence

Above statement is a sample.

I want to get everything between the most deeply nested parentheses. In the above statement this is,'%Y-%m-%d'


How to do that with regex?

Answer Source

You can try this regex /(\([^\(\)]+\))/


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download