Function is = findtagpair(s,t1,t2)
[is,errors] = findtagpair(s,t1,t2)
returns a matrix is, with indices in string s:
-- at the begin of tag t1 (first column in is),
-- at the end of tag t1 (second column in is),
-- at the begin of tag t2 (third column in is),
-- at the end of tag t2 (fourth column in is).
Input arguments s, t1 ane t2 are all strings (i.e.
row vectors of characters).
Output matrix is is empty if no matches are found,
or if errors are found.
To get the text between the k'th match, write
s( (is(k,2)+1):(is(k,3)-1) )
In this way, the result will be automatically an
empty string if there happen to be no text between
the tags.
Output string errors contains error messages, when
matches do not seem correct. If the output argument
errors is not requested, errors will be printed
on screen rightaway.
(c) 2026 fabien van mook
2026.08.20 release of this file within package "fvm-miscellaneous" under GNU GPLv3+