• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 179
  • Last Modified:

Base64 Error Checking

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

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?
  • 3
1 Solution
Jens FiedererTest Developer/ValidatorCommented:
You could use regular expressions.

Replace [^a-zA-Z0-0/+] with the empy string.
Jens FiedererTest Developer/ValidatorCommented:
Make that [^a-zA-Z0-9/+]  (mistyped).
sk33v3Author Commented:
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?
Jens FiedererTest Developer/ValidatorCommented:
system.Text.RegularExpressions.Regex.Replace("123#$%abc" & vbCRLF & "foo---+/bar1", _
             "[^0-9A-Za-z/+]", "", Text.RegularExpressions.RegexOptions.Singleline)

will give you:

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now