We've addressed this subject before although I can't find th thread.
So here it is again and with a twist.
First a string parser to separate the string into a list of strings using a
delimiter character.
This string "one,two,three,four" becomes '("one" "two" "three" "four")
Then a parser that allows for the use of an over ride of the delimiter.
So this "This|is|a`|test|string" becomes this '("This" " is" "a'|test" "string")
Although my routine did not remove override character perhaps it should.
So the result would be this '("This" " is" "a|test" "string")
Here are some form that I tested on mine.
(defun c:test ()
(print (sparser "This|is|a`|test|string" "|" "`"))
(print (sparser "|This|is|a`|test|string|" "|" "`"))
(print (sparser "`|This|is|a`|test|string`|" "|" "`"))
(print (sparser "" "|" "`"))
(print (sparser "`|This|is|a`|test|string`|" "|" ""))
(princ)
)
I clean up the list returned like this:
(vl-remove "" (sparser "This|is|a`|test|string" "|" "`"))
removing any empty text.
and or use this to remove the override characters
(mapcar '(lambda(x) (vl-string-subst "" skp x)) lst)
<edit: spelling correction>