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 an issue with marshall and unmarshall readers and writers. So here it is.
Have 2 tables in Access 2007, both lists of certain tasks to be accomplished.
have a nice day. I got problem when trying to create an image from
I have resources :campaigns defined in routes.rb. If I create a form_for @campaign in
First: my apologies if I am getting the nomenclature wrong! Basically, I have a
Have not done this before, so obviously I suck at it. Here 64 pixels
Have have this line of code in my form when I create a new
Forgive/correct me if my nomenclature is incorrect. I have never understood the use of
For a project I have a series of pseudo-repositories that create XML (they aren't
Have some runtime defined schedule for one week, for example: <schedule> <s day=Monday, time=1:00:00></s>

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.