Suppose you have a string like this
.((((((.(((((((((((((((((((((...((((...)))).((((...))))))))))))))))))))))))))))))).
and I want to omit the part ...((((...)))).((((...)))
and get only the outer level of parenthesis. How can I do this in Perl?
Usually the strings I encounter in my work are something like this
(((((.(((((((((((((((((((((...((((((.....))))))..........))))))))))))))))))))))))))
and in this case it is easy to implement using index
function to specify the position of the last (
and the first )
, but in the nested case I tried using stacks to implement but it didn't work.
This is the first nested loop to be omitted .((((((.(((((((((((((((((((((...((((...)))).((((...))))))))))))))))))))))))))))))). and this is the second .((((((.(((((((((((((((((((((...((((...)))).((((...))))))))))))))))))))))))))))))). according to this I must omit all the characters in between these parenthesis .((((((.(((((((((((((((((((((...((((...)))).((((...))))))))))))))))))))))))))))))).