Being new to something is an opportune time to experiment in order to learn it.
A regular expression may be overkill. Since the source string is a comma-delimited collection of values, why not just obtain the portion of the string you need using existing String methods. You might review the String API for ideas.
Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
You're coming in saying "I need to use THIS to solve my problem". You'd be better off saying "I need to solve this problem - what would be the best way to do it?"
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Is the "cn" always the first key-value pair? Is it always followed by the "ou" key-value pair? Because if the answer to either of these questions is "no", your solution won't work.