powershell v3.0 - How Can I Regex Match The Common Name of This DN? -


given string cn=smith\, john,ou=users,ou=it,dc=contoso,dc=com, seeking match complete common name, including comma after it. i'm trying remove part, matching other part work too.

the result after removal or filter ought ou=users,ou=it,dc=contoso,dc=com.

i tried ^.+(?=,ou=) no flags captures cn=some\, guy,ou=users

the language/regex standard powershell, can figure out conversion standard, solution better am.

you can try this: ^.+?(?=,ou=), , shell match entire string until ou part.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -