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

"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?
LVL 9
sk33v3Asked:
Who is Participating?
 
Jens FiedererConnect With a Mentor Test Developer/ValidatorCommented:
system.Text.RegularExpressions.Regex.Replace("123#$%abc" & vbCRLF & "foo---+/bar1", _
             "[^0-9A-Za-z/+]", "", Text.RegularExpressions.RegexOptions.Singleline)


will give you:

"123abcfoo+/bar1"
0
 
Jens FiedererTest Developer/ValidatorCommented:
You could use regular expressions.

Replace [^a-zA-Z0-0/+] with the empy string.
0
 
Jens FiedererTest Developer/ValidatorCommented:
Make that [^a-zA-Z0-9/+]  (mistyped).
0
 
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?
0
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.

All Courses

From novice to tech pro — start learning today.