Add PCRE to support regular expressions

Use regular expressions instead of Lua patterns for find and replace editor commands.

Syntax files can now use regex or Lua patterns as before keeping backward compatibility for plugins.
This commit is contained in:
Adam
2021-06-02 21:27:00 +02:00
committed by GitHub
parent ea5e9b0ce5
commit 248d70a8ca
11 changed files with 257 additions and 70 deletions
+6 -3
View File
@@ -237,9 +237,12 @@ command.add(nil, {
end)
end,
["project-search:find-pattern"] = function()
core.command_view:enter("Find Pattern In Project", function(text)
begin_search(text, function(line_text) return line_text:find(text) end)
["project-search:find-regex"] = function()
core.command_view:enter("Find Regex In Project", function(text)
local re = regex.compile(text, "i")
begin_search(text, function(line_text)
return regex.cmatch(re, line_text)
end)
end)
end,