%% Negating Boundaries of Letters and Digits
% Use the ~ operator to negate alphanumericBoundary. This pattern matches the boundary between two characters when both are alphanumeric characters or neither character is alphanumeric.
% Create a string that contains several different character types. Create a pattern that matches a negated alphanumericBoundary.

txt = "123 abc .?!";
pat = ~alphanumericBoundary;

% Use replace to insert "|" characters to show where ~alphanumericBoundary matches.

boundaries = replace(txt,pat,"|")

% Copyright 2020 The MathWorks, Inc.