For loop string.match不';我不能在Lua for loop中工作
我正在尝试使用for循环来获取web论坛中每个帖子的作者姓名、id和内容。 我试过了,但没用。如果没有for循环,我将获得文档中正则表达式的第一个结果。 有什么建议吗For loop string.match不';我不能在Lua for loop中工作,for-loop,lua,lua-patterns,For Loop,Lua,Lua Patterns,我正在尝试使用for循环来获取web论坛中每个帖子的作者姓名、id和内容。 我试过了,但没用。如果没有for循环,我将获得文档中正则表达式的第一个结果。 有什么建议吗 for author_id, author_name, author_joined, author_posts, post_date, post_content in string.match(content, "<span class=\"name\">
for author_id, author_name, author_joined, author_posts, post_date, post_content in
string.match(content,
"<span class=\"name\"><a name=\"(%d-)\"></a><b>([^<]+).-Joined: ([^<]+).-Posts: ([^<]+).-<span class=\"postdetails\">Posted: ([^<]+).-<span class=\"postbody\">(.-)</span><span class=\"postbody\"></span>")
do
document:appendContent("Name: " .. author_name)
end
end
作者id、作者姓名、加入的作者、作者帖子、发布日期、发布内容
string.match(内容,
([^要在泛型for
循环中使用,您需要一个迭代器,使用string.gmatch
(global match)而不是string.match
)