I want to extract the string after the last occurrence of "cn=" using regex in C# application. So what I need is the string between last occurence of "cn=" and \ character Please note that the source string may contains spaces.
Example:
ou=company\ou=country\ou=site\cn=office\cn=name\ou=pet
Result:
name
So far Ive got (?<=cn=).*
for selecting the text after the cn= using positive lookbehind and (?:.(?!cn=))+$
for finding the last occurence but I dont know how to combine it together to get desired result.