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
Thanks for your time. Penguin.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; } }
In reply to regex anchoring issue by penguin-attack
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |