Module:IdentifierRACJ

De alcolois
Aller à la navigation Aller à la recherche

local p = {}

-- Extrait un identifiant de la forme : 2 chiffres - 7 chiffres (ex: 40-0009775)
function p.extraireNoDeDecision(frame)
    local texte = frame.args[1] or ""
    -- Match un identifiant de type 40-0009775
    local identifiant = string.match(texte, "(%d%d%-%d%d%d%d%d%d%d)")
    return identifiant or ""
end

-- Extrait un identifiant de la forme : 2 chiffres - 7 chiffres - 3 chiffres (ex: 40-0733535-004)
function p.extraireNoDeDossier(frame)
    local texte = frame.args[1] or ""
    -- Match un identifiant de type 40-0733535-004
    local identifiant = string.match(texte, "(%d%d%-%d%d%d%d%d%d%d%-%d%d%d)")
    return identifiant or ""
end

return p