• Welcome to the Kancolle Wiki!
  • If you have any questions regarding site content, account registration, etc., please visit the KanColle Wiki Discord

Difference between revisions of "Module:RegExpr"

From Kancolle Wiki
Jump to navigation Jump to search
(Created page with "local re = {} function re.regExpr(frame) -- frame[1] = test string -- frame[2] = Lua pattern return string.match(frame[1], frame[2]) end")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
local re = {}
 
local re = {}
  
function re.regExpr(frame)
+
function re.findMatch(frame)
-- frame[1] = test string
+
-- args[1] = test string
-- frame[2] = Lua pattern
+
-- args[2] = Lua pattern
return string.match(frame[1], frame[2])
+
result = string.match(frame.args[1], frame.args[2])
 +
if (result == nil) then
 +
result = ""
 +
end
 +
return result
 
end
 
end
 +
 +
return re

Latest revision as of 06:02, 1 June 2017

Documentation for this module may be created at Module:RegExpr/doc

local re = {}

function re.findMatch(frame)
	-- args[1] = test string
	-- args[2] = Lua pattern
	result = string.match(frame.args[1], frame.args[2])
	if (result == nil) then
		result = ""
	end
	return result
end

return re