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

  • SEARCH
  • Home
  • 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 3968184
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:48:42+00:00 2026-05-20T03:48:42+00:00

For input text like A.B.C.D. EFG, I would like to get permutations of letters

  • 0

For input text like “A.B.C.D. EFG”, I would like to get permutations of letters followed by dots to be converted to add space after the dot. So for the example above, I would like to get “A.B.C.D.”, “A. B.C.D.”, “A.B. C.D.”, “A.B.C. D.”, “A. B. C.D.”, “A.B. C. D.”, “A. B. C. D.”

Can this be done with regex ? If yes then any regex sample that works with c# (.net) would be most appreciated. The number of characters with dots is not known and can vary from text to text.

On a side note, if the text is “A. B. C. D. EFG” or “A. B.C.D. EFG” etc, I would like to get all permutations for that.

Regards

  • 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-20T03:48:43+00:00Added an answer on May 20, 2026 at 3:48 am

    Something like

    static string[] GetPermutations(string input)
    {
        List<string> ret = new List<string>();
        List<string> cleanInput = new List<string>();
        foreach (string bit in input.Split('.'))
        {
            if (bit.Trim().Length > 0) cleanInput.Add(bit.Trim());
        }
        foreach (string bit in cleanInput)
        {
            if (ret.Count == 0)
            {
                ret.Add(bit);
                continue;
            }
            List<string> oldRet = ret;
            ret = new List<string>();
            foreach (string oldBit in oldRet)
            {
                ret.Add(oldBit + bit);
                ret.Add(oldBit + " " + bit);
            }
        }
        return ret.ToArray();
    }
    

    Then, to call it:-

    foreach (string p in GetPermutations("A.B. C.D."))
    {
        Console.WriteLine(p);
    }
    

    It outputs:-

    ABCD
    ABC D
    AB CD
    AB C D
    A BCD
    A BC D
    A B CD
    A B C D
    

    You just need to add the dots in, and check any other unspecified logic you may need (eg, stripping away the EFG’s from your example input.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to know how can i read a value of input text
I would like to read a text file and input its contents into an
I'm making a form and would like text input field to be inside of
I would like to be able to input text in either Left-to-Right and Right-to-Left
I would like a text input with the question what browser are you using
If i have input text in form like this <form action=add.php method=post> <input type=text
I would like the value of the input text box to be highlighted when
I am working on semantic web project where user will input text query like
I have a text input field like text box or text area. I want
I'd like to create a text input with a clear button in a confined

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.