%% Negate Boundaries of Lines
% Use the ~ operator to negate lineBoundary. This matches boundaries between two characters when neither is a newline character.
% Create a string with a newline character. Create a pattern that matches letters that are neither at the start nor end of a line of text.

txt = "This is line one" + newline + "Here is line two";
pat = ~lineBoundary + lettersPattern + ~lineBoundary;

% Extract the pattern.

firstWord = extract(txt,pat)

% Copyright 2020 The MathWorks, Inc.