MATLAB: Remove parenthesis and the contents inside from a string

string

Is there a neat way to remove a parenthesis and the contents inside from a string. For example the string
A = 'abc (ABC)'
% how to extract 'abc' from A, get rid of ' (ABC)' including the leading whitespace?
One cumbersome solution is:
temp = strsplit(A,'(');
B = strtrim(temp(1));

Best Answer

A = 'abc (ABC)';
B = regexp(A,'^\w+','once','match')
B = 'abc'
Related Question