%% Search Using Patterns
% Since R2020b
% Create a string array that contains addresses.

str = ["221B Baker St.","Tour Eiffel Champ de Mars","4059 Mt Lee Dr."]

%
% To find addresses that contain numbers, create a pattern that matches an arbitrary number of digits by using the digitsPattern function.

pat = digitsPattern

%
% Return a logical array indicating which strings contain digits. Display the matching strings.

TF = contains(str,pat)
str(TF)

%
% Search for strings that have a sequence of digits followed by one letter. You can build more complex patterns by combining simple patterns.

pat = digitsPattern + lettersPattern(1)
TF = contains(str,pat);
str(TF)

%
% For a list of functions that create pattern objects, see pattern.
% Copyright 2020 The MathWorks, Inc.