lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, 24 Jul 2011 21:23:56 +0100, Peter Cawley <lua@corsix.org>
wrote:
>Works for me:
>line=[[<a href="/places/1.php">1</a> <a href="/places/2.php">2</a>]]
>for w in string.gmatch(line, '<a href="/places/.-%.php">') do print(w) end
>
>Gives:
><a href="/places/1.php">
><a href="/places/2.php">
>

Found it: There were cases where the URL was followed by other
attributes:
==========
<a href="/places/0.php">dummy<a href="/places/1.php"
class="N11">dummy<a href="/places/2.php">
==========

This code does the job:
==========
for w in string.gmatch(line, '<a href="/places/%w%.php">') do
==========

Thank you all.