in reply to Re^3: Multi-line regex help needed
in thread Multi-line regex help needed

I have to respectfully disagree there, what I posted and the "actual data" are one and the same (to the best of my knowledge)

The full text file (redacted to get rid of an actual domain and IPs) is over here: http://www.yoda.im/pmonks.txt

Replies are listed 'Best First'.
Re^5: Multi-line regex help needed
by Limbic~Region (Chancellor) on Jun 18, 2009 at 17:21 UTC
    vxp,
    You can disagree all you want, but the data you posted is different than the code you ran against. See the following as proof: Again, I believe it is because the $ you pasted in your root node aren't really there in your real data. When I look at the data you linked against, I can see that the $ are in fact not there. I am not trying to be a pain, I am just explaining why the code I wrote for the data you provided isn't working against the data you need it to (they aren't the same).

    I did provide other suggestions by the way. Have you looked into those?

    Cheers - L~R

      Of course the $ isn't there - I said in the very first post that this is cat -vue's output :)

      cat -vue shows you all characters, including special characters (like the end of line $) - I thought it might be useful to see for regex crafting

        vxp,
        Of course the $ isn't there - I said in the very first post that this is cat -vue's output

        Well, I have two things to say to that. First, you get what you ask for if you make assumptions about the knowledge of the people helping you. Second, the first time I mentioned $ not really being there should have been an indication to you that I didn't know what I was talking about. In any event, here is a working proof of concept since you have had to suffer through my ignorance.

        #!/usr/bin/perl use strict; use warnings; my $file = $ARGV[0] || 'foo.txt'; open(my $fh, '<', $file) or die "Unable to open '$file' for reading: $ +!"; my $buffer = ''; while (<$fh>) { if (/^\S+domain\.com$/) { process_buffer($buffer); $buffer = $_; next; } $buffer .= $_; } sub process_buffer { my ($section) = @_; print "================BLAH================\n$section\n"; }

        Cheers - L~R