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}|MT\d{2}[A-Z]{4}\d{5}[A-Za-z0-9]{18}|MU\d{2}[A-Z]{4}\d{19}[A-Z]{3}|NL\d{2}[A-Z]{4}\d{10}|NO\d{13}|SA\d{4}[A-Za-z0-9]{18}|SC\d{2}[A-Z]{4}\d{20}[A-Z]{3}|SI\d{17}|SV\d{2}[A-Z]{4}\d{20}|TR\d{8}[A-Za-z0-9]{16}|UA\d{8}[A-Za-z0-9]{19}|VG\d{2}[A-Z]{4}\d{16}|GE\d{2}[A-Z]{2}\d{16})$'
),
1,
-1
),
0
)
Documentation:
This formula checks if the structure of TODO_REPLACE_WITH_IBAN is a valid IBAN structure (each country has its own specification).
Specifications:
- https://www.iban.com/structure
- https://docs.google.com/spreadsheets/d/1376mu58jQ2P5jGX7tIXGrFfwgfo0RHO7RBRSpKcViIs/edit?usp=sharing Google Sheet based on the above data structure, easier to work with
- https://stackoverflow.com/a/69068004/2391795
This file has been truncated. show original