Suppose I have a list of arbitrary length like:
{1, 2, 3, "Open", 3, 2, "Close", 9, 3, 4, "Open", 1, 0, "Close", 3, 5}
and I am trying to extract the sequences insidedelimited by the open"Open"/close"Close" tags, i.e. the answer I want is:
{{3, 2}, {1, 0}}
What's the right way to do this? The data I am actually working with is a large XML document and I am trying to extract sections of it by identifying certain tags as boundaries. I've fiddled with different pattern matching functions but can't figure out how to operate on a list in this way since I am trying to match patterns on an intermediate level between individual elements and the entire list.
EDIT
To clarify, I don't know in advance how many such sequences the data will contain or how many elements will be insidepresent between any particular set of tags.