开发者

VB.net Regex extract data from string

开发者 https://www.devze.com 2023-01-23 19:01 出处:网络
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 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 someo开发者_开发问答ne please help me.


Try this regexp:

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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消