Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local nr = nil
- nr = {next = nr, regex = "^%d%d%d%d%d%d%d" , before="+7888", inplace = nil }
- nr = {next = nr, regex = "^38341" , before=nil, inplace = "Berdsk:"}
- nr = {next = nr, regex = "^838341" , before=nil, inplace = "Berdsk:"}
- nr = {next = nr, regex = "^+738341" , before=nil, inplace = "Berdsk:"}
- -- точно так же заполняется urir:
- local urir = nil
- urir = {next = urir, regex = "^89" , before=nil, inplace = "9"}
- local function canonicValue(param, list)
- local node = list
- while node do
- if string.match(param, node.regex) then
- local matched = string.match(param, node.regex);
- local matchedLength = string.len(string.match(param, node.regex));
- local before = node.before;
- local inplace = node.inplace;
- local result = "";
- if before~=nil then
- result = result .. before;
- end
- if inplace~=nil then
- result = result .. inplace;
- else
- result = result .. matched;
- end
- result = result .. string.sub(param, matchedLength+1);
- return result
- end
- node = node.next
- end
- return param
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement