%% Find Patterns in Multiple Pieces of Text
% Find the location of capital letters and spaces within character vectors in a cell array.

str = {'Madrid, Spain','Romeo and Juliet','MATLAB is great'};
capExpr = '[A-Z]';
spaceExpr = '\s';

capStartIndex = regexp(str,capExpr);
spaceStartIndex = regexp(str,spaceExpr);

% capStartIndex and spaceStartIndex are cell arrays because the input str is a cell array.
%
% View the indices for the capital letters.

celldisp(capStartIndex)

%
% View the indices for the spaces.

celldisp(spaceStartIndex)

% Copyright 2012 The MathWorks, Inc.