Small library of input masks for lua inspired by v-mask.
- Lua5.1+ (or LuaJIT 2.0+)
local lmask = require("lmask")
Phone number
local phoneNumber = lmask('(####)-##-##-###', '04128692598')
-- (0412)-86-92-598
Passport document
local passportDocument = lmask('A-########-#', 'J234176882')
-- J-23417688-2
Here is a list placeholders you can utilize by default:
Placeholder | Format |
---|---|
# | Number (0-9) |
A | Letter in any case (a-z,A-Z) |
lmask is available under the MIT license. Details can be found in the LICENSE file.