jos graber wrote:Programatically, I need to have words which end with ')' to be in an extra pair of brackets..
...
Is there any way this can be achieved ?
Sure, but you
first need to define precisely what a "word" is (for your purposes at least). And don't write
one line of
Java code until you have one that covers EVERY possible eventuality, including nasty ones that might be hard to work out.
So: what is a "word"? Describe it for us -
in detail.
You might also want to think about scenarios where you have
more than one word, eg:
...(DT This is an)...
(if it can happen), and also cases where the input contains
invalid information (unless you've been specifically told to assume that it will always be "correct").
Anyone can write code that works when everything is fine; good programmers write code that works when it
isn't.
HIH
Winston