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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T05:53:26+00:00 2026-06-09T05:53:26+00:00

I have an example log that i am trying to find the best solution

  • 0

I have an example log that i am trying to find the best solution to get me pieces of information: Mainly time stamp and a specific string.

Example Log Output: Each are on 1 Line

####<Jun 22, 2012 12:54:18 PM CDT> <Notice> <WebLogicServer> <lname> <dname> <main>
<<WLS Kernel>> <> <BEA-000360> <Application started in RUNNING mode>

Each log line has the 4 beginning # tag followed by <Timestamp> all pieces that are relevant to my scenario have the <> enclosed brackets and i want to have an array of information where the index is based on left to right reads.

For each <> bracket, i want to store its information in the lineArray.

using (var reader = new StreamReader(@"C:\Projects\test.txt"))
{
    foreach(var line in ReadLines(reader)) 
    {
          //add logic to parse and read info into brackets
        String sLine = (String)line;
        String splitD = sLine.Split("<>")[0];
    }
}
  • 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-06-09T05:53:28+00:00Added an answer on June 9, 2026 at 5:53 am

    Well, I’m not a regexp guru, but this should work:

    string test = "####<Jun 22, 2012 12:54:18 PM CDT> <Notice> <WebLogicServer> <lname> <dname> <main>"
        + "<<WLS Kernel>> <> <BEA-000360> <Application started in RUNNING mode>";
    var pattern = @"\<+(.*?)\>+";
    var matches = Regex.Matches(test, pattern);
    foreach (Match m in matches)
    {
        Console.WriteLine(string.Format("-{0}-", m.Groups[1]));
    }
    
    Console.ReadKey();
    

    Output (actual matches between - chars):

    -Jun 22, 2012 12:54:18 PM CDT-
    -Notice-
    -WebLogicServer-
    -lname-
    -dname-
    -main-
    -WLS Kernel-
    --
    -BEA-000360-
    -Application started in RUNNING mode-
    

    string test = "####<Jun 22, 2012 12:54:18 PM CDT> <Notice> <WebLogicServer> <lname> <dname> <main> <<WLS Kernel>> <> <BEA-000360> <Application started in RUNNING mode>"
        + Environment.NewLine + "####<Jun 23, 2012 12:54:18 PM CDT> <Notice> <WebLogicServer> <lname> <dname> <main> <<WLS Kernel>> <> <BEA-000360> <Application started in RUNNING mode>"
        + Environment.NewLine + "####<Jun 24, 2012 12:54:18 PM CDT> <Notice> <WebLogicServer> <lname> <dname> <main> <<WLS Kernel>> <> <BEA-000360> <Application started in RUNNING mode>";
    
    List<Foo> foo = new List<Foo>();
    using (StringReader reader = new StringReader(test))
    {
        string line;
        while ((line = reader.ReadLine()) != null)
        {
            string pattern = @"\<+(.*?)\>+";
            var matches = Regex.Matches(line, pattern);
    
            foo.Add(new Foo
                {
                    Timestamp = matches[0].Groups[1].ToString(),
                    Field2 = matches[1].Groups[1].ToString()
                });
        }
    }
    

    Output:

    A list of 3 Foo objects, each with a different Timestamp (Jun 22, Jun
    23, Jun 24)

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

Sidebar

Related Questions

I have a problem that I have been trying to find a solution for
I am trying to find a good example that can help me to understand
I'm trying to get the GKTank example working with 2 iPhones. Both have bluetooth
I am trying to find a tool that will extract the module version information
I have a txt file that has a change-log.I'm trying to display the new
Let's have an example like below: package xliiv.sandbox; import android.app.Activity; import android.os.Bundle; import android.util.Log;
For example suppose I have the following two functions function a(param1) { console.log(param1); }
I have lines in a log file, appended chronologically. For example, it could be
Anyone have example Rx code that shows how to execute an action due to
The issue Let's say that I have example.com, example.org and example.net. All of these

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.