Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1002847
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T07:53:14+00:00 2026-05-16T07:53:14+00:00

I have a nomenclature to respect while performing some tasks against the Active Directory.

  • 0

I have a nomenclature to respect while performing some tasks against the Active Directory.

Here’s the nomenclature:

  • TT-EEE-Mnemonic: if TT = ‘GA’ or ‘GS’ or ‘PA’ or ‘PF’ -> the schema to create is a “group”, with a groupScope of Global.
    1. LT-EEE-Mnemonic: if T = ‘A’ or ‘G’ or ‘I’ or ‘N’ or ‘P’ -> the schema to create is a “group”, with a groupScope of Domain local.
    2. TTT-EEE-Mnemonic: if TTT* = ‘CNX’ or ‘GST’ or ‘SVC’ -> the shema to create is an “user”
    3. T-SSSS-Mnemonic: if T = ‘A’ or ‘L’ or ‘M’ or ‘R’ or ‘S’ -> the schema to create is an “organizationUnit”

What I’m after is a simpler and more effective way than this:

If(dn.Substring(3, 2).Contains("GA") _
    Or variable.Substring(3, 2).Contains("GS") _
    Or dn.Substring(3, 2).Contains("PA") _
    Or dn.Substring(3, 2).Contains("PF")) Then 
    schema = "group" ' Global'
Else If(dn.Substring(4, 1).Contains("A") _
    Or dn.Substring(4, 1).Contains("G") _
    Or dn.Substring(4, 1).Contains("I") _
    Or dn.Substring(4, 1).Contains("N") _
    Or dn.Substring(4, 1).Contains("P")) Then
    schema = "group" ' Local'
Else If(dn.Substring(3, 3).Contains("CNX") _
    ' Well... You get the idea, don't you?
End If

I guess I could use a RegularExpression, or perhaps one for each of the nomenclature I got, something alike.

Is there a way a RegularExpression could become handy in this situation? Or would it be best to stick with that old big-If? Any suggestions are welcome.

Sorry for asking, but I’m not used to use RegularExpression. I know they exist, and bit of what they can do, but that’s all.

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T07:53:14+00:00Added an answer on May 16, 2026 at 7:53 am

    It’d vastly reduce the number of tests and explicit Ors.

    If Regex.IsMatch(dn, "^CN=(G[AS]|P[AF])-") Then
        schema = "group"    ' Global                 'damn syntax highlighting
    ElseIf Regex.IsMatch(dn, "^CN=L[AGINP]-") Then
        schema = "group"    ' Local                  'damn syntax highlighting
    ElseIf Regex.IsMatch(dn, "^CN=(CNX|GST|SVC)-") Then
        schema = "user"
    ElseIf Regex.IsMatch(dn, "^CN=[ALMRS]-") Then
        schema = "organizationUnit"
    End If
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you ever tried learning a language while on a project? I have, and
First: my apologies if I am getting the nomenclature wrong! Basically, I have a
I have some HTML/PHP code in Dreamweaver and for the life of me I
Have some dates in my local Oracle 11g database that are in this format:
For a project I have a series of pseudo-repositories that create XML (they aren't
Hoping I can get some architectural advice on this. I have been given the
I have been working on porting some Oracle DB code to Postgres, and I
I'm sorry if inverse is not the preferred nomenclature, which may have hindered my
I'm banging my head up against Cocoa and Xcode, and have been for months.
Have a look at this picture alt text http://www.abbeylegal.com/downloads/2009-04-01/web%20part%20top%20line.jpg Does anyone know what css

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.