%% Match Boundaries of Text
% Use textBoundary to match the start or end of text.
% Create a string array with multiple pieces of text. Create a pattern that matches the first word of each piece of text.

txts = ["This is the first piece of text" 
    "Here is the second" 
    "Now there are three"];
pat = textBoundary + lettersPattern;

% Extract the pattern.

firstWords = extract(txts,pat)

% Copyright 2020 The MathWorks, Inc.