Since you seem to already have a good idea of what you want to have happen, I would suggest writing some tests that demonstrate that your function behaves as you wish it to.
Often times I find that, by the time I have the tests written enough to be useful, the code almost writes itself.. and it makes the really hard things possible by keeping a hard copy around of what getting each little piece working entails.
If you have a representative sample of the data you are trying to reformat, it might help to pull out some 'hard' cases from it, or indeed start with a simplistic solution, and use that until you can find some data that it breaks with.
In reply to Re: Find a good starting section of a long text
by Tuppence
in thread Find a good starting section of a long text
by johnnywang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |