fork(2) download
  1. -- your code goes here
  2. local mystring='<span class="my-author"><a href="http://aaaa/author/abb-abbb/" title="Posts by abb" class="author" rel="author">abc xyz</a></span>'
  3.  
  4. local x, y = string.find(mystring,'<span class="my-author">', 0, true)
  5. local w, z = string.find(mystring,'</a></span>', x, true)
  6. local author
  7. print(x,y,w,z)
  8. if y==nil or w==nil then
  9. print(author)
  10. else
  11. author = string.sub(mystring, y+1, w-1)
  12. print(author)
  13. end
Success #stdin #stdout 0s 2836KB
stdin
Standard input is empty
stdout
1	24	120	130
<a href="http://aaaa/author/abb-abbb/" title="Posts by abb" class="author" rel="author">abc xyz