%asFewOfPattern Creates a pattern that matches as few times as possible
%   NEWPAT = asFewOfPattern(PAT) returns a pattern that will match PAT as 
%   few times as possible including zero times.
%
%   NEWPAT = asFewOfPattern(PAT,minPattern) returns a pattern that matches PAT 
%   as few times as possible but at least minPattern times.
%
%   NEWPAT = asFewOfPattern(PAT,minPattern,maxPattern) returns a pattern that matches 
%   PAT as few times as possible but at least minPattern times and no more than 
%   maxPattern times.
%
%   Examples
%       STR = ["bb bab babab babaaabab"];
%
%       NEWPAT = "b" + asFewOfPattern(lettersPattern(1)) + "b";
%       extract(STR,NEWPAT)                   % returns  ["bb";"bab";"bab";"bab";"bab"]
%
%       NEWPAT = "b" + asFewOfPattern(lettersPattern(1),3) + "b";
%       extract(STR,NEWPAT)                   % returns  ["babab"; "babaaab"]
%
%       NEWPAT = "b" + asFewOfPattern(lettersPattern(1),3,4) + "b";
%       extract(STR,NEWPAT)                   % returns  ["babab"; "baaab"]
%
%   See also pattern, asManyOfPattern, optionalPattern, contains, extract.

%   Copyright 2019-2020 The MathWorks, Inc.