This assumes that, were parens are used, there won’t be embedded parens, and the closing paren is always followed by a comma or ends the line. It also assumes there is a match in each column as empty columns will be skipped.
there are multiple parenthesis level in one item.
in fact it is to extract some sql subqueries and consider only each resulting column.
the subquery has to be considered as one column.
(select account.code from account where account.id=convert (SUBSTRING_INDEX(SUBSTRING_INDEX(sales_document.custom_fields_raw, 'custom_2921:', -1), ';', 1) , unsigned)),
sales_document.code,
sales_document.date,
account.name,
sales_document.customer_reference,
sales_document.amount,
sales_document.vat_amount,
sales_document.amount_with_vat,
(select sum(amount) from sales_schedule where sales_schedule.sales_document_id=sales_document.id),
status.label
it works as it finds the right commas I need to use. then replaces it with a pipe | and I can search with NthField
not the most effective method, but it works …
Kem if you have anything more efficient, I’m taking it !
The pattern I posted works with the text you posted, but since you said there could be embedded parens and your sample text doesn’t show that, I don’t consider it completely representative.
This is getting trickier than you might imagine. What happens if there is a comma between quotes or in a remark? I think it’s doable, but more work than I can put into it at the moment.