PtokaX forum

Lua 5.3/5.2/5.1 Scripts (for PtokaX 0.4.0.0 and newer) => Help with scripts => Topic started by: Hamachi on 03 June, 2011, 14:34:16

Title: lua regex
Post by: Hamachi on 03 June, 2011, 14:34:16
test = "lua regex test"
local q = test:find("^(php|lua)") --(php|lua)

some there can help me whit that, it dont works :(

it is only an example, but i dont understand why it nok work, hsall use it in some code i are working one :(
Title: Re: lua regex
Post by: PPK on 03 June, 2011, 15:45:44
You should read Lua manual  ;) It is not regex (regex library is bigger than whole Lua), they call it pattern matching and it's different than regex :-\
Title: Re: lua regex
Post by: Hamachi on 03 June, 2011, 16:23:39
ok hehe have i do it in lua ?
test = "lua"
test.find(test|lua|php|java)
Title: Re: lua regex
Post by: Hamachi on 03 June, 2011, 21:21:27
I dont understand the lua way, pls help me.

thansk :D
Title: Re: lua regex
Post by: bastya_elvtars on 04 June, 2011, 11:37:47
http://www.lua.org/docs.html
http://lua-users.org/wiki/TutorialDirectory