pattern matching - Getting certain text inside HTML with Lua? -
currently have lua script made. 1 seems it's little inefficient, , second thing want no spaces in result, except between 2 words. example: "hello there" thanks!
st=[[<h1 class="notranslate" data-se="item-name"> lookin cool </h1>]] l,s=string.find(st,[[<h1 class="notranslate" data%-se="item%-name">]]) n, w=string.find(string.sub(st, l), [[</h1>]]) x=string.sub(st, s, n) r=string.gsub(x, "[%s]+", "") n=string.gsub(r, "%p", "") print(n)
this works me i'm not sure it's seek:
print(st:match(">%s*(.-)%s*<"))
.
in line solution, try
print(st:match('<h1 class="notranslate" data%-se="item%-name">%s*(.-)%s*<'))
Comments
Post a Comment