MatchesXsBase64Binary🔗

Type: Pattern verification
Check that text conforms to the pattern of an xs:base64Binary.
text🔗
Text to be checked
Return🔗
True if the text conforms to the pattern

Code

b04Char = '[AQgw]'
b04 = (
    f'{b04Char}\\x20?'
)
b16Char = (
    '[AEIMQUYcgkosw048]'
)
b16 = (
    f'{b16Char}\\x20?'
)
b64Char = '[A-Za-z0-9+/]'
b64 = (
    f'{b64Char}\\x20?'
)
b64quad = (
    f'({b64}{b64}{b64}{b64})'
)
b64FinalQuad = (
    f'({b64}{b64}{b64}{b64Char})'
)
padded8 = (
    f'{b64}{b04}= ?='
)
padded16 = (
    f'{b64}{b64}{b16}='
)
b64final = (
    f'({b64FinalQuad}|{padded16}|{padded8})'
)
base64Binary = (
    f'({b64quad}*{b64final})?'
)
pattern = (
    f'^{base64Binary}$'
)
return match(
    pattern,
    text
) is not None