(1) The first
pattern you require would be "MyFunc\\(.+?\\)". If this is used in String.split() it should
give you the desired result. The brackets () have to be preceded by \\ in order to differentiate them
the grouping operators which are also brackets. The .+? means one or more of any character can
occur in the brackets. The reluctant quantifier +? is used instead of the greedy quantifier +, else
MyFunc(ab)0123MyFunc(1234) would be matched instead of each individual instance of MyFunc(x)
(2) For the second part of your question I think something like the following will work:
In this case anything between the brackets of myFunc is grouped and can be retrieved by m.group(1)
(m.group() or m.group(0) will retrieve the full match)
However, having said all this, reluctant quantifiers and using grouping to capture contents is not on the exam
(Objective 3.5), so this is probably more information than you need to know
Martin