Hi Monks,

I have 3 potential input files that user can input

8=FIX.4.2<SOH>

8=FIX.4.2^A (^A in text )

8=FIX.4.2^A (^A as a Control char hidden)

I want to split by the end character either <SOH> ^A or ^A

my split will work for \cA and <SOH> but I cant get it working for the text based ^A

Logic - 1) read the file in . 2) run through each line splitting on regex match for either text ^A or control A or <SOH . 3)stick in array .4) remove whitespace from array . 5) else throw error

Heres the code:

Problem is that if a tag is encounter like this : 8=A^A, it strips the first A instead of the ^A

I know its staring at me in the face but dunno why my regex ignores the text based ^A

sub reader { my $stream = "$somefile"; open( FILE, $stream ) or die "Cant open File:$!\n"; while (<FILE>) { if ( $_ =~ m/[\^A\cA\<SOH\>]{1}/g ) { @split= split /[\^A\cA\<SOH\>]+/g, $_; foreach my $line (@split) { foreach my $line (@split) { ( $line =~ s/[\s\n]{1,}//g ); } } } else { my $url = "http:/xxxxx.com/error.html"; my $t = 0; # time until redirect activates print "<META HTTP-EQUIV=refresh CONTENT=\"$t;URL=$url\">\n +"; last; } }
Thanks for your time. Penguin.

In reply to regex anchoring issue by penguin-attack

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.