I have a variable that represents a user string (it's an L-DAP string). From this variable, I need to return everything before the first comma and everything after the first equals sign.

Here's an example of the string value:
CN=mrfoobar11,OU=XYZ,OU=ABC Users,DC=blahad,DC=foobar,DC=com
Essentially, I just need "mrfoobar11" and that's all. I tried using substr to get everything after the first equals sign but when I tried to do the same thing with everything up to the first comma, I began to think I needed a RegEx--which I'm betting I don't.

Any suggestions / hints is appreciated.