How can i find text between two phrases?
ex: <::hi::> (i want "hi"
Find text between phrases
Started by Creeper9207, Apr 07 2015 09:01 PM
4 replies to this topic
#1
Posted 07 April 2015 - 09:01 PM
#2
Posted 07 April 2015 - 09:06 PM
for word in string.gmatch("<::hi::.hi...hi","%w") do
print(word)
end
will print any words but not characters.
#3
Posted 07 April 2015 - 09: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...LibraryTutorial
#4
Posted 07 April 2015 - 09:39 PM
I think he's asking for something more like this kind of thing:
http://www.lua.org/pil/20.2.html
local myText = "<::hi::>" print(string.match(myText, "<::(.-)::>"))
http://www.lua.org/pil/20.2.html
Edited by Bomb Bloke, 07 April 2015 - 09:42 PM.
#5
Posted 08 April 2015 - 12:30 AM
thanks
i found pattern <:
.+)::> worked
i found pattern <:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











