2
Replace text using Lua pattern syntax
6
s=s and s:gsub('"', '\\"') or ""
7
assert(loadstring('rv="'..s..'"'))()
12
if geany.count() > 0 then
14
local dlg = dialog.new("Lua replace", {"Replace All", "Cancel"})
17
" Replaces text using Lua pattern matching syntax. ")
19
dlg:text("find", nil, "Old needle: ")
20
dlg:text("repl", nil, "New needle: ")
22
if (#geany.selection()>0) then
23
dlg:group("scope", "sel", "Haystack:")
24
dlg:radio("scope", "doc", "Document")
25
dlg:radio("scope", "sel", "Selection")
28
local btn, results = dlg:run()
32
local func = (results.scope=="sel") and geany.selection or geany.text
33
func(string.gsub(func(), esc(results.find), esc(results.repl) ))
38
geany.message("No document!")