简体   繁体   中英

Ignore a certain pattern in Lua (garry's mod lua 5.1)

found a new way with a php dump of a mysql database and 15 lines of lua, no pattern finding. Mod can delete this.

I'm trying to separate this into separate parts of a table, but I can't figure out how to make a pattern to ignore a specific thing.

local output = "<tr><td>ABAH</td><td>A Basic Anti Hack</td><td><a href=\"mailto:email@hotmail.de\">Clark</a></td><td><a href=\"plugins/12/sv_abah.lua\">Download</a>"

for plugin in output:gmatch("<tr>(.-%S)Download</a>") do 
    --print( plugin ) 
    for title in plugin:gmatch("<td>(.-%S)</td><td>") do 
        print(title)
    end
    for description in plugin:gmatch("</td><td>(.-%S)</t") do 
        print(description)
    end
 end

So far it outputs the title and the description, but also outputs the mail link, how can I make it ignore that?

Outputs:

 1.ABAH
 2.<a href="mailto:email@hotmail.de">Clark</a>
 3.A Basic Anti Hack

I used http://codepad.org/XQ6rZ6ZM for testing.

Is there some reason why you can't simply apply another pattern to clean out the HTML for example:

local output = "<tr><td>ABAH</td><td>A Basic Anti Hack</td><td><a href=\"mailto:mirkoiz@hotmail.de\">Clark</a></td><td><a href=\"plugins/12/sv_abah.lua\">Download</a>"

for plugin in output:gmatch("<tr>(.-%S)Download</a>") do 

        for title in plugin:gmatch("<td>(.-%S)</td><td>") do             
        title= title:gsub('<.->','')  
        print(title)
        end
        for description in plugin:gmatch("</td><td>(.-%S)</t") do 
        description = description:gsub('<.->','')     
        print('description)
        end

end

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM