I have a string like
s = "<foo> <bar ... <baz.ind>
and I need only the contents of the last <...>. In the above case it should be only baz.ind.
The below code prints not only the "baz.ind".
The <...> is always the last one in a string or does not exist, eg s=a b c. Something like s=<a> b c should also be nil, because there is no <...> at the end.
My idea, which does not work:
s = "<foo> <bar ... <test.ind>"
for w in string.gmatch(s, '([^<]+)>') do print(w) end
RegEx match open tags except XHTML self-contained tags. does not help, because it matches all combinations of <...> and not only the last one.
'([^<]+)>$'