Test, validate and match regular expressions
This regex accurately validates Base64 encoded strings by enforcing proper character classes and correct padding rules. It checks that the string consists of valid Base64 characters (alphanumeric, '+', '/'), groups them into blocks of four, and ensures that any trailing '=' padding uses only the allowed preceding characters for one or two padding symbols. It is ideal for validating Base64 data in APIs, configuration files, or form inputs where malformed padding or length must be rejected.