I searched on Google and on Stack Overflow and didn't find answer for this question. Looking at the documentation I didn't find how to do this because every function that allows splits excludes the delimiter.
EDIT
for i, word in pairs(split(text, "<(.-)>")) do
print(word)
end
function split(string, delimiter) -- Got this function from https://helloacm.com/split-a-string-in-lua/
result = {};
for match in (string..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
This code replaces the parts in the format "<(.-)>"
Example:
Input: "Hello<a>World</a>!"
Expected Output: {"Hello", "<a>", "World", "</a>", "!"}
Real Output: {"Hello", "World", "!"}