%optionalPattern Creates a pattern that may be omitted when matching
%   NEWPAT = optionalPattern(PAT) returns a pattern that matches PAT
%   when possible and will be omitted otherwise.
%
%   Examples
%       STR = "foo bar foobar";
%       PAT = "foo" + optionalPattern("bar");
%       extract(STR,PAT)                   % returns  ["foo"; "foobar"]
%
%   See also pattern, asManyOfPattern, asFewOfPattern, contains, extract.

%   Copyright 2019-2020 The MathWorks, Inc.