Solved

Base64 Error Checking

Posted on 2006-06-23
4
164 Views
Last Modified: 2010-04-23
I am trying to find an easy way to remove any data which does not belong in a base 64 string. IE the string might look like the one below

"Hello
This is a test


please note VbCrLf's are not allowed in Base64 nor are single qoutes."

Is there an easy why just to replace all the non base 64 characters?
0
Comment
Question by:sk33v3
  • 3
4 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 16971794
You could use regular expressions.

Replace [^a-zA-Z0-0/+] with the empy string.
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 16971799
Make that [^a-zA-Z0-9/+]  (mistyped).
0
 
LVL 9

Author Comment

by:sk33v3
ID: 16971815
Sorry I am not familiar with regular expressions. I vaguely know what they are but I have not used them. Within my code how would I use that?
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 500 total points
ID: 16971897
system.Text.RegularExpressions.Regex.Replace("123#$%abc" & vbCRLF & "foo---+/bar1", _
             "[^0-9A-Za-z/+]", "", Text.RegularExpressions.RegexOptions.Singleline)


will give you:

"123abcfoo+/bar1"
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Article by: jpaulino
XML Literals are a great way to handle XML files and the community doesn’t use it as much as it should.  An XML Literal is like a String (http://msdn.microsoft.com/en-us/library/system.string.aspx) Literal, only instead of starting and ending with w…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now