%% Select Text Between Substrings
% Create string arrays and select text that occurs between substrings.
% Starting in R2017a, you can create strings using double quotes.

str = "The quick brown fox"

%
% If you are using R2016b, create string arrays using the string function instead of double quotes.
% Select the text that occurs between the substrings "quick " and " fox". The extractBetween function selects the text but does not include "quick " or " fox" in the output.

newStr = extractBetween(str,"quick "," fox")

%
% Select substrings from each element of a string array. When you specify different substrings as start and end indicators, they must be contained in a string array or a cell array that is the same size as str.

str = ["The quick brown fox jumps";"over the lazy dog"]

%

newStr = extractBetween(str,["quick ";"the "],[" fox";" dog"])

% Copyright 2012-2020 The MathWorks, Inc.