local example = "12345#data" for i in string.gmatch(example, "[^#]+") do print(i) end