« Module:IdentifierRACJ » : différence entre les versions
Modification pour capturer les numéros de décisions qui ont la forme xx-500-xxxx ex. 40-5001234 |
Aucun résumé des modifications |
||
| Ligne 1 : | Ligne 1 : | ||
local p = {} | local p = {} | ||
-- Extrait | -- Extrait un identifiant de la forme : dd-500xxxx ou sinon dd-ddddddd | ||
function p.extraireNoDeDecision(frame) | function p.extraireNoDeDecision(frame) | ||
local texte = frame.args[1] or "" | local texte = frame.args[1] or "" | ||
-- 1. | -- 1. Match un identifiant de type 40-500xxxx | ||
local identifiant = string.match(texte, "(%d%d%-500%d%d%d%d)") | local identifiant = string.match(texte, "(%d%d%-500%d%d%d%d)") | ||
if identifiant then | if identifiant then | ||
| Ligne 11 : | Ligne 11 : | ||
end | end | ||
-- 2. Sinon, | -- 2. Sinon, match un identifiant générique de type dd-ddddddd (ex: 40-0009775) | ||
identifiant = string.match(texte, "(%d%d%-%d%d%d%d%d%d%d | identifiant = string.match(texte, "(%d%d%-%d%d%d%d%d%d%d)") | ||
return identifiant or "" | return identifiant or "" | ||
end | end | ||