You can avoid using a 'crappy' expression. If you already have the DN, you can split the String and then find the CN. For example:
String dn = "CN=Jimmy Blooptoop,OU=Someplace,OU=Employees,DC=Bloopsoft-Inc";
String[] split = dn.split(",");
for (String x : split) {
if (x.contains("CN=")) {
System.out.println(x.trim());
}
}