How to grep substring from a line ?

Hi all,
I am stuck in a tricky situation where i want to search a substring from a line through shell script.What i meant by that is given in the example shown below:

Line :: This is the TEST(Message(with some tricky word)) from which i want to search.
Result substring should be : Message(with some tricky word)

How can i get only "Message(with some tricky word)" from the Line "This is the TEST(Message(with some tricky word)) from which i want to search." ?

I cant format a RegExp for this kind of search. Please help me to format such tricky Regular Expression with some useful commands .Thanks in advance.

To do things like this, one normally needs some 'anchors' or known targets. From your example I can assume certain things about character placement and parenthesis, but that may have been just the way you typed that one line.
Would like to see something along the lines of:

Message from user Joe (Sent 10/13/08(Fix the hard drive))
Print for PTR_1(Update 10/17/08(re-install driver complete))
Message for Sue(Sent 10/21/08(Out of disk space))

Are you trying to pull something like that apart?

only for that example string.

# string="This is the TEST(Message(with some tricky word))"
# echo ${string#*(}
Message(with some tricky word))
# str=${string#*(}
# echo ${str%)*}
Message(with some tricky word)

sed --version
GNU sed version 4.1.5

echo "This is the TEST(Message(with some tricky word)) from which i want to search." \ 
| sed 's/.*TEST(\{1\}\(.*\))\{1,\}.*$/\1/'

explanation:
.* - look for any number of any character (including none)
TEST - followed by TEST
(\{1\} - followed by 1 ( [and only 1, if you want it to match more than 1 use \{1,\}]
\( - remember what you match from now on
.* - look for any number of any character (including none)
\) - end remembering matches
)\{1,\} - followed by 1 or more )
.*$ - followed by 0 or more characters to the end of the line

s/<regex>/\1/ - will substitute (s) what the regex matches, with the first remembered item from the regex.

so all that outputs

Message(with some tricky word)

You have the line as a variable so why more tricky actions to get the same result?
It's sufficient if the grep command is successful..or have I missed something?

Regards

> echo "This is the TEST(Message(with some tricky word)) from which i want to search." | cut -d")" -f1-2 | cut -d"(" -f2-
Message(with some tricky word)
> 
echo "This is the TEST(Message(with some tricky word)) from which i want to search." |  sed 's/.*\(TEST.*))\).*$/\1/'

Here are some more examples for every one to make it more clear what i want ...!

EXAMPLE ::
The input string will be like this :

This is another example where TEST( string is going to be (after TEST everytime ) and it will be in the (braces all the time like this ) so this clears my requirements. ) ;

Result should be :

string is going to be (after TEST everytime )

There will be more variety in terms of braces but the string to be searched will always be after TEST and in the braces starts immediately after TEST upto the end of that brace only.

Thank You all for your reply. I think i have found the solution for my query.I am putting it here.

echo "This is the TEST(Message(with some tricky word)) from which i want to search." | sed -e 's/.TEST(//g ; s/),.//g'