The best help you're going to receive is for someone to suggest that you use a parsing module instead of a monster regular expression to handle this task. You're not manipulating text, you're manipulating what looks to me a lot like HTML. Use an HTML parser. Regular Expression based solutions to parsing HTML are fragile, and difficult to maintain.
It may be possible to 'fix' the issue you're having using some variation of the regular expression you've constructed, but it will break again as soon as the input takes on some characteristic you weren't anticipating. A good parser won't balk at textual nuances that could hamper regular expressions solutions.
Dave
In reply to Re: Trouble in text manipulation
by davido
in thread Trouble in text manipulation
by thirilog
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |