"OU =" smells like you do an Active Directory or LDAP search and respond to the results. While regex is a brilliant tool, I just wanted to make sure that you also know the excellent System.DirectoryServices.Protocols classes that were created to parse, filter, and manipulate just such data.
SearchResult, SearchResultEntry, and DirectoryAttribute, in particular, will be the friends you might be looking for. I have no doubt that you can use a regex or substring as good as the next guy, but it's also nice to have another good tool in the toolbar.
Have you tried these classes?
Sir wobin
source share