Check string matches pattern
Posted on 2004-03-26
Basically, I want to check if a string is base64 encoded. If you can think of a good way to do this (other than the way I'm about to suggest), please tell me!
I think I want to check if the string contains only letters of the alphatbet (both uppercase and lowercase), numbers, equal signs (=) forward slashes (/) and no spaces. If the string is like this, I'm going to treat it as base64 encoded.
I've no idea how I would check a string for this. I suppose I would use preg_match or ereg or some other simliar function, but learning all that syntax is just too complicated. Would someone give me a function I could use?
Many thanks in advance...