简体   繁体   中英

VB.net Regex extract data from string

I am trying to extract data from a string using Regex in VB.net. This is my string

CN=firstname lastname/OU=orgunit/O=org;shortname

I am basically trying to retrieve

firstname lastname (together)
orgunit
org
shortname

can someone please help me.

Try this regexp:

^/CN=([^/]*)/OU=([^,]*),O=([^;]*);(.*)$

(first capture group is name, second is orgunit, third is org, fourth is shortname)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM