MATLAB: How can I extract special contents of a text

regexptext processingtextscan

given a text with several parenthesis in format of (a,b). how can I extract contents of these parenthesis( a and b)? I used textscan and regexp but unsuccessful.

Best Answer

regexp(yourstring, '(?<=\()[^)]+', 'match')
should do it. It matches any sequence of anything but closing brackets preceded by an opening bracket. Note that the opening bracket has to be escaped as it's a special character in regexes.