Help with regex

Hi,

I have a string like this

[ log(x, y), pow(x, ceil(x)), 3, 5, …]

where there are N elements separated by a comma. So I’d like to get

log(x,y)
pow(x, ceil(x))
3
5

The problem is twofold:

  1. N is not fixed
  2. I have to ignore the commas which are included in round brackets.
    Any ideas on how I could create the regex for this?

Thanks!

Ok, I solved by making a custom Split command.

It is considered good etiquette to actually post the solution for those in a similar situation :wink:

In this case, that might be the better option. The problem is not so much that you need to ignore the commas within parenthesis, it’s that the parenthesis might be nested so you have to get into subroutines and recursion.

Amazing. I did not even try to post any suggestion since the original post was so specific that the solution was to be Regex.

Such elementary problem can indeed be solved with Split, plus maybe some astute ReplaceAll to deal with unwanted quotes.

There is life beyond reggae :wink: