extractBetween
Extract substrings between start and end points
Syntax
Description
extracts the substring from newStr
= extractBetween(str
,startPat
,endPat
)str
that occurs between the
substrings startPat
and endPat
. The extracted
substring does not include startPat
and
endPat
.
newStr
is a string array if str
is a string
array. Otherwise, newStr
is a cell array of character
vectors.
If str
is a string array or a cell array of character vectors,
then extractBetween
extracts substrings from each element of
str
.
forces the starts and ends specified in any of the previous syntaxes to be either
inclusive or exclusive. They are inclusive when newStr
= extractBetween(___,'Boundaries',bounds
)bounds
is
'inclusive'
, and exclusive when bounds
is
'exclusive'
. For example,
extractBetween(str,startPat,endPat,'Boundaries','inclusive')
returns startPat
, endPat
, and all the text
between them as newStr
.
Examples
Input Arguments
Output Arguments
Extended Capabilities
Version History
Introduced in R2016b
See Also
split
| join
| erase
| eraseBetween
| extract
| extractBefore
| extractAfter
| insertAfter
| insertBefore
| replace
| replaceBetween
| strlength
| count
| pattern
| wildcardPattern