by Dost Muhammad Shah    2 Comments  →

We can validate a base64 encoded string using a nice regex (regular expression). The following regex can be used with any programming language. I would use php for the example. The regex is as follows.


Which will also detect the usage of = or == at the end of the string (and only end).

A function geared specifically toward this:

<?phpfunction is_base64_encoded()
     if (preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $data)) {
           return TRUE;
     else {
             return FALSE;
 is_base64_encoded("iash21iawhdj98UH3"); // true
 is_base64_encoded("#iu3498r"); // false
 is_base64_encoded("asiudfh9w=8uihf"); // false
 is_base64_encoded("a398UIhnj43f/1!+sadfh3w84hduihhjw=="); // false

1 Comment  →
   by Dost Muhammad Shah    1 Comment  →

I use WPML on one of WordPress site I developed for my company. recently I installed bbpress plugin to incorporate a forum on the same website. When I used both plugin together I found that I couldn’t reply or create a new topic. It was strange that suddenly the Forum, topics and reply (All the elements added by bbpress to wp-admin menu bar ) were hidden. Continue reading