简体   繁体   English

忽略Lua中的某个模式(Garry的mod lua 5.1)

[英]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. 用mysql数据库的php转储和15行lua找到了一种新方法,没有找到模式。 Mod can delete this. Mod可以删除它。

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. 我使用http://codepad.org/XQ6rZ6ZM进行测试。

Is there some reason why you can't simply apply another pattern to clean out the HTML for example: 是否有某些原因导致您不能简单地应用其他模式来清除HTML,例如:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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