?
Solved

Base64 Error Checking

Posted on 2006-06-23
4
Medium Priority
?
177 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 2000 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Integration Management Part 2
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses
Course of the Month16 days, 5 hours left to enroll

850 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