%% Match Ahead of Specified Pattern
% Create a pattern that matches ahead of "b" or "2".

txt = "abc 123";
pat = lookAheadBoundary("b"|"2");

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

replace(txt,pat,"|")

% Copyright 2020 The MathWorks, Inc.