Enclosed_polylines is about finding EACH closed area in a selection. If it's not what you are looking for, then you should explain better.
I'd really like to see each of the 2 samples you already posted, but with both "before" and "after" situation.
And, most important, how do you see them the same? For me, looks like 2 different tasks.
PFB function that works as per your list and which doesn't limit the sub-list:
(defun foo (l / m n)
(foreach x l
(cond ((wcmatch (strcase x) "START*")
(if m
(setq n (cons (reverse m) n))
)
(setq m (list x))
)
(t (setq m (cons x m)))
)
)
(if m
(setq n (cons (reverse m) n))
)
(reverse n)
)
Program use:
_1$ (foo '("START" "X1" "X2" "X3" "X4" "XN" "ENDXN" "STARTX" "X" "X" "X" "X" "ENDX"))
(("START" "X1" "X2" "X3" "X4" "XN" "ENDXN") ("STARTX" "X" "X" "X" "X" "ENDX"))
_1$ (foo '("START" "X1" "X2" "X3" "X4" "XN" "ENDXN" "STARTX" "X" "X" "ENDX"))
(("START" "X1" "X2" "X3" "X4" "XN" "ENDXN") ("STARTX" "X" "X" "ENDX"))
_1$ (foo '("START" "X1" "X2" "X3" "X4" "X5" "X6" "XN" "ENDXN" "STARTX" "X" "X" "ENDX"))
(("START" "X1" "X2" "X3" "X4" "X5" "X6" "XN" "ENDXN") ("STARTX" "X" "X" "ENDX"))