RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Valid Base64 string
Expression
(([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)?){1}
Description
The expression evaluates a Base64 string as a sequence of 4-byte blocks with a possible tail of 2 or 3-byte block with valid padding.
Matches
AAAAAA==
Non-Matches
AAAAAA
Author Rating: Not yet rated. Vassilis Petroulias
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Mr.
Name: James Nixon
Date: 8/23/2011 2:19:59 PM
Comment:
It finds Base64 strings, but it also finds other sub-characters using the Java Matcher class. I had to use the non-intuitive Pattern.split(...) to get a String array and use the array status to use the regex string (0 size => Base64, otherwise not Base64).


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials