I'm new to this website. Here's a problem that troubled me for >2 hr. I have a string (phylogenetic tree in newick format), which looks like:
((A:14,B:43):22,C:76,(D:54,(E:87,F:28):17):35);
The tree may have multiple levels, indicated by parentheses. Now I want to add a number, say, 10, to the top level numbers (branch lengths). Here there are only three top level numbers: 22, 76, 35. After the convertion the string should look like:
((A:14,B:43):32,C:86,(D:54,(E:87,F:28):17):45);
I have tried my best thinking out a proper regex, but finally admitted my limitation. How can it be done really?