lua-users home
lua-l archive

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


> Please let me know why gsub() doesn't accept a plain option?

I guess the main reason was that it is not very common the use of gsub
over a fixed string. Anyway, there is an easy way to protect a pattern:

  function plaingsub (s, p, r)
    p = gsub(p, '(%W)', '%%%1')
    return gsub(s, p, r)
  end

-- Roberto