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 523507
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:28:10+00:00 2026-05-13T08:28:10+00:00

Thanks in advance. What i currently have is a filedialog box selecting a text

  • 0

Thanks in advance. What i currently have is a filedialog box selecting a text file. The text file contents will look like example.txt, and it needs to look like output.txt. NOTE: the string CoreDBConnectString= is 1 line all the way to ;Database=Source_DB.

example.txt
[Information]
Date=
CreatedBy=
Unique=eqwe-asd-123-as12-3
CoreDataSource=
CoreDBConnectString=Provider=SQLOLEDB.1;Server=Server;Integrated Security=SSPI;Database=Source_DB
NoteDataSource=SQLServer
NoteDBConnectString=Provider=Provider=SQLOLEDB.1;Server=Server;Integrated Security=SSPI;Database=Source_DB
CoreDBCaseID=99
NoteDBCaseID=99


Output.txt
Table=99  (Comes from CoreDBCaseID)
Server=Server (comes from the string CoreDBConnectString=)
Security=SSPI (comes from the string CoreDBConnectString=)
Database=Source_DB (comes from the string CoreDBConnectString=)
  • 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-13T08:28:11+00:00Added an answer on May 13, 2026 at 8:28 am

    You can do something like this:

    // Load the file contents
    string contents = File.ReadAllText("example.txt");
    
    // Obtain the data using regular expressions
    string id = string id = Regex.Match(
        contents, 
        @"CoreDBCaseID=(?<id>\d+)").Groups["id"].Value;
    
    string server = string.Empty; // Add regex here
    string security = string.Empty; // Add regex here
    string database = string.Empty; // Add regex here
    
    // Save the data in the new format
    string[] data = new string[] {
        String.Format("Table={0}", id),
        String.Format("Server={0}", server),
        String.Format("Security={0}", security),
        String.Format("Database={0}", database)
    };
    
    File.WriteAllLines("output.txt", data);
    

    And a quick way to learn those regular expressions:

    Regular Expression Cheat Sheet

    Regular-Expressions.info


    You can use a positive lookahead to stop matching at the (;) character. Something like this:

    @”Security=(?[\D]+)(?=;)”

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

Sidebar

Related Questions

Thanks in advance for your help. I have a need within an application to
Thanks in advance for your assistance. I have the following exported part: [Export (typeof(INewComponent))]
I currently have a db structure that looks something like what i have below
I currently have my project running two separate threads (one for MFC operations, like
I currently have a rewrite rule in htaccess that looks like this: RewriteRule ^/?p/(.+)/(.+)/(.+)/(.+)/(.+)/
I currently have a link that launches a telnet link like this <h:outputLink value=telnet://1.2.3.4>
I currently have working code that inserts rows into a table. It looks like
I currently have a table that looks something like this: +------+-------+------------+------------+ | id |
I currently have a table in the following format and with the following example
I currently have a list of time diffs in G:i format. I would like

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.