Parsing irc raw data

Posted on 2005-05-08
Last Modified: 2012-06-27
Hello, what would be the feasible way to parse the raw IRC data given below? 372 Google123 :- *☻!☻* *☻!☻*] 376 Google123 :End of /MOTD command. NOTICE Google123 :*** Notice -- This server runs an
open proxy monitor to prevent abuse. NOTICE Google123 :*** Notice -- If you see connectio
ns on various ports from NOTICE Google123 :*** Notice -- please disregard the
m, as they are the monitor in action. NOTICE Google123 :*** Notice -- For more information
 please visit NOTICE Google123 :on 1 ca 1(2) ft 10(10) tr
:Q! PRIVMSG Google123 :☺VERSION☺
:Q! NOTICE Google123 :Type "/msg Q news" for the latest GalaxyNet news! (updated 14/9/2004 11:19)

Question by:dr0zaxx
    LVL 92

    Expert Comment

    certainly :)

    looks like splitting on : would be a good start

    String[] tokens = line.split(":");
    Then parse each field as required
    LVL 1

    Author Comment

    spliting on : would be dangerous right? let's say a user post something in his message that contains ":" ..

    wrong info would be parsed.
    LVL 92

    Accepted Solution

    Perhaps, it would depend on the exact details of format.
    Perhaps all you need is the uindex of the first two :'s and treat everything after the second as text, something like:

    int first = line.indexOf(':');
    int second = line.indexOf(':', first+1);
    String details = line.substring(first+1, second-1);
    String[] parts = details.split(" ");

    LVL 1

    Author Comment

    Ok, thanks for your help anyway, based on your first answer, i managed to figure out a solution myself..

    using StringTokenizer and split together. thanks

    Featured Post

    Free Trending Threat Insights Every Day

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    This was posted to the Netbeans forum a Feb, 2010 and I also sent it to Verisign. Who didn't help much in my struggles to get my application signed. ------------------------- Start The idea here is to target your cell phones with the correct…
    Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
    Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now