Solved

Base64 Error Checking

Posted on 2006-06-23
4
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
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…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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