java当格式为姓氏\,First Name时,如何从LDAP CN中仅获取姓氏
CN=Belzile\,Pierre,OU=LaptopUser,OU=Users,DC=Company,DC=local
我只需要把“贝尔齐尔·皮埃尔”还给你。 我需要关于正则表达式语法的帮助
对于正则表达式,我们使用Java语法https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
预期结果: 贝尔齐勒·皮埃尔
你可以在下面搜索框中键入要查询的问题!
CN=Belzile\,Pierre,OU=LaptopUser,OU=Users,DC=Company,DC=local
我只需要把“贝尔齐尔·皮埃尔”还给你。 我需要关于正则表达式语法的帮助
对于正则表达式,我们使用Java语法https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html
预期结果: 贝尔齐勒·皮埃尔
# 1 楼答案
您可以使用这个正则表达式在group1和group2中捕获名字和姓氏
Demo
Java代码
打印您的预期输出