I have an input of 10+sqrt(10+(100*20)+20)+sqrt(5)
which I need to be able to split up into sqrt(...)
as many times as sqrt
appears (in this instance, twice). The problem I am having is trying to split this up, I have tried on my own and come up with this (sqrt\()(?<=sqrt\()(.+?)(\)+)
but regex only registers the first )
it comes across whereas I need it to find the closing bracket.
As you can see in the picture the orange marker only covers up to the first bracket but i need it to end at the +20
.
The desired output is a list as follows:
['10+', 'sqrt(', '10+(100*20)+20', ')', '+', 'sqrt(', '5', ')']
Thanks in advance