%% Match Boundaries of Letters
% Use letterBoundary to divide a string along boundaries between letters and nonletter characters.
% Create a pattern that matches any letter boundaries.

txt = "123 abc .?! def 456";
pat = letterBoundary;

% Use replace to insert "|" characters at the matched boundaries.

replace(txt,pat,"|")

% Copyright 2020 The MathWorks, Inc.