&Text::Balanced::extract_tagged will do what you want. It is a core module.
After Compline,Zaxo
In reply to Re: Balanced delimiter parsing by Zaxo in thread Balanced delimiter parsing by moxliukas