Regular Expressions 101

Community Patterns

Community Library Entry

3

Regular Expression
PCRE (PHP <7.3)

/
(?:^(?:[A-Za-z0-9+\/]{4}\n?)*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)$)
/

Description

This regular expression validates if given string is formatted in Base64, additional it accepts new lines, since payload can have new lines in it.

Submitted by wpodgorski - 9 years ago