lua-users home
lua-l archive

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


Hi,

I'm looking for a gsub pattern to remove leading and trailing spaces.
Some examples:

" Lua  "          -> "Lua"
"Lua   "          -> "Lua"
"  Lua"           -> "Lua"
" Lua Language "  -> "Lua Language"
"  "              -> ""

The best I could do is "^%s*(.*%S)%s*$", but this doesn't 
work with the last example.

I guess there is something simpler.

Thanks,
Danilo