42 lines
786 B
Lua
42 lines
786 B
Lua
return {
|
|
-- Matches: a URL in parens: (URL)
|
|
{
|
|
regex = "\\((\\w+://\\S+)\\)",
|
|
format = "$1",
|
|
highlight = 1,
|
|
},
|
|
-- Matches: a URL in brackets: [URL]
|
|
{
|
|
regex = "\\[(\\w+://\\S+)\\]",
|
|
format = "$1",
|
|
highlight = 1,
|
|
},
|
|
-- Matches: a URL in curly braces: {URL}
|
|
{
|
|
regex = "\\{(\\w+://\\S+)\\}",
|
|
format = "$1",
|
|
highlight = 1,
|
|
},
|
|
-- Matches: a URL in angle brackets: <URL>
|
|
{
|
|
regex = "<(\\w+://\\S+)>",
|
|
format = "$1",
|
|
highlight = 1,
|
|
},
|
|
-- Then handle URLs not wrapped in brackets
|
|
{
|
|
-- Before
|
|
--regex = '\\b\\w+://\\S+[)/a-zA-Z0-9-]+',
|
|
--format = '$0',
|
|
-- After
|
|
regex = "[^(]\\b(\\w+://\\S+[)/a-zA-Z0-9-]+)",
|
|
format = "$1",
|
|
highlight = 1,
|
|
},
|
|
-- implicit mailto link
|
|
{
|
|
regex = "\\b\\w+@[\\w-]+(\\.[\\w-]+)+\\b",
|
|
format = "mailto:$0",
|
|
},
|
|
}
|