Oct 19, 2018 Hi all. I found this example in some old folders on my pc and decided to share here. it is a simple code to check if a string is base64 hash. This example use a regex. Code: Copy Sub isBase64(text As String) As Boolean If Regex.IsMatch("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$", text.Trim) And text.Length > 3 Then Return True Else Return False End If End Sub Example of use Code: Copy ' TESTA A STRING CODIFICADA COM BASE64 Log(isBase64("ZG91Z2xhc2Zhcmlhcw==")) '=douglasfarias ' TESTA A STRING COM TEXTO Log(isBase64("Test string"))'=dont is a base64 string The result log is true false Credits: stackoverflow, Douglas Farias and Flavio Rocha Attachments isbase64.zip isbase64.zip 229.2 KB · Views: 840 Last edited: Dec 2, 2018 Click to expand...
Hi all. I found this example in some old folders on my pc and decided to share here. it is a simple code to check if a string is base64 hash. This example use a regex. Code: Copy Sub isBase64(text As String) As Boolean If Regex.IsMatch("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$", text.Trim) And text.Length > 3 Then Return True Else Return False End If End Sub Example of use Code: Copy ' TESTA A STRING CODIFICADA COM BASE64 Log(isBase64("ZG91Z2xhc2Zhcmlhcw==")) '=douglasfarias ' TESTA A STRING COM TEXTO Log(isBase64("Test string"))'=dont is a base64 string The result log is true false Credits: stackoverflow, Douglas Farias and Flavio Rocha