I have a html formatted string:
s = "<span class=\"ads__unit__content__details\"> <span>Data I want to extract</span> </span> <p class=\"ads__unit__content__keys\"> \
<span>More data I want to extract</span> <span>Even more data I want to extract</span> </p> <p>"
I am trying to extract the different parts using a string pattern:
StringCases[s, "<span>"~~x__~~"</span>"-> x]
But this somehow just works on the outermost tag pairs. This is the resulting output:
{"<span>Data I want to extract</span> </span> <p \class=\"ads__unit__content__keys\"> <span>More data I want to \
extract</span> <span>Even more data I want to extract</span>"}
Why does it ignore the
</span>
tags in the middle of the string? I would expect a list with all the substrings separated..
ImportString[s, "HTML"]
? $\endgroup$