Regular Expressions 101

Community Patterns

Community Library Entry

0

Regular Expression
Created·2019-11-05 19:29
Flavor·PCRE (Legacy)

/
^(?:[[:alnum:]+\/]{4})*(?:[[:alnum:]+\/]{2}[AEIMQUYcgkosw048]=|[[:alnum:]+\/][AQgw]==)?$
/
gm
Open regex in editor

Description

Invalid entries still can be interpreted, e.g.

encode(0xAB) => qw==

however invalid encoding qx== still can be correctly decoded:

decode(qx==) => 0xAB.

If you want invalid encoding to match, use different (less strict) regex.

Replace [:alnum:] with A-Za-z0-9 if your regex library does not support that notation.

Submitted by anonymous