in reply to Re: Regex problem i think?
in thread Regex problem i think?

Ive tried every version of what you told me and it dosent seem to match, the file im using is a csv file that is full of system information. the files first line is:

9/9/2013,1:42:00 PM,gupdate,Information,None,0,N/A,DANIEL-3332D452,The + description for Event ID ( 0 ) in Source ( gupdate ) cannot be found +. The local computer may not have the necessary registry information +or message DLL files to display messages from a remote computer. You +may be able to use the /AUXSOURCE= flag to retrieve this description; + see Help and Support for details. The following information is part +of the event: Service stopped.
the biggest problem im having is the regex seems to break it. right after i call the regex it never goes into the loop to check. I appreciate the quick responses. Yes count should have been up one loop, i start moving things around when it dosent work

Replies are listed 'Best First'.
Re^3: Regex problem i think?
by Athanasius (Archbishop) on Sep 10, 2014 at 12:35 UTC

    If your data is in a CSV file then you will be much better off extracting the data using a dedicated CSV module. For example, Text::CSV_XS by Tux is highly recommended. You should extract the relevant field(s) first, and only then apply one or more regexes to those fields to extract the data you want.

    We’re going to need more information before we can give further help. The best way to provide us with that information is to follow the advice in How do I post a question effectively?

    Include (inside <code>...</code> or <c>...</c> tags) a minimal script that reproduces your problem and sample data (input).

    — together with the output you actually get and the output you want.

    P.S. It’s chomp that’s in the wrong part of the loop, not $count.

    Hope that helps,

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      I want to say sorry to make you guys look at this, i learned alot, It wasent working because my teacher wanted to play a sick prank and give me a file that had no matches in it. Thank you for the advise, the code worked fine!

        So make up your own test set and check the code that way!

        Your teacher is probably kinder than the world in general. Learning to check your assumptions and your work are a vital component of programming.

        Perl is the programming world's equivalent of English