224 posts
Posted 07 April 2015 - 10:01 PM
How can i find text between two phrases?
ex: <::hi::> (i want "hi"
1080 posts
Location
In the Matrix
Posted 07 April 2015 - 10:06 PM
for word in string.gmatch("<::hi::.hi...hi","%w") do
print(word)
end
will print any words but not characters.
105 posts
Posted 07 April 2015 - 10:18 PM
You could use a combination of the string.find() and string.sub() function to do this, finding the first occurence of "<::" and the first of "::>" and then with string.sub taking the parts in between. Information on these functions:
http://lua-users.org/wiki/StringLibraryTutorial
7083 posts
Location
Tasmania (AU)
Posted 07 April 2015 - 10:39 PM
I think he's asking for something more like this kind of thing:
local myText = "<::hi::>"
print(string.match(myText, "<::(.-)::>"))
http://www.lua.org/pil/20.2.html
Edited on 07 April 2015 - 08:42 PM
224 posts
Posted 08 April 2015 - 01:30 AM
thanks
i found pattern <::(/>.+)::> worked