lua-users home
lua-l archive

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


I thought that stripping HTML tags was easy until I saw something like this:
<a href=""; alt="> example"> example </a>

My code was:
local s = '<a href=""; alt="> example"> example </a>'
s = string.gsub(s, '<.->', ' ')
print(string.gsub(s, '<.->', ' '))

-> example"> example

I have seen some examples using PHP and regular expressions. Programming in Lua 20.1 says that Lua cannot do all what POSIX implementation does ( Can this be done in Lua? All that come to my mind are captures but I'm not sure if they help at all. Of course my example works in most of the cases, but it would be nice to have it work even better.