• string.match help
    4 replies, posted
So I was trying to create a recursive thing to detect includes in code. Unfortunately, it only finds the first pattern match and not the rest. If I do [lua] local anticheat = "include(\"blah.lua\") include(\"moreblah.lua\")" print( anticheat:match( "^include%S+" ) ) [/lua] The output is [lua] include("blah.lua") [/lua] I need it to output everything found with that pattern, am I doing anything wrong or what do I do?
^ means it will only match at the start of the string, remove it and it should work (unless there's something else I'm overseeing)
It still doesn't work.
[lua] anticheat:match( "include%(\"[%w_%.]-\"%)" ) [/lua] Try that.
Still no success. [editline]12:28AM[/editline] Nevermind, string.match has start indexes. Thanks for your help!
Sorry, you need to Log In to post a reply to this thread.