in reply to Re^2: Message regex
in thread Message regex

So using Regexp::List how would i pass in the tags, So if i were looking for something like 35= 109= 55= etc etc
my $re = $l->list2re(qw/35= 109= 55=/);
But how does when loop through each part of my message and extract the values.
2005/11/18 00:06:49:875: FIXPump: Received data on connection {OBMSCNX +} [8=FIX.4.29=040435=849=EXLINK256=DB_ORDER50=DESRISKGATEWAY57=DCN323 +0134=4045052=20051118-05:06:491=ATOP116=0.0000000011=DES:fud630_20051 +11814=15.000017=0131730433520=031=138.0800000032=15.000037=1317260622 +38=15.000039=254=155=CibntractZ60=20051118-05:06:49150=2151=values=13 +173047101317260622109=DCN3230163=0167=FUT200=200512207=TSE40=244=138. +080000005113=06556=20051117-23:06:4610=230]

Replies are listed 'Best First'.
Re^4: Message regex
by minixman (Beadle) on Nov 25, 2005 at 09:39 UTC
    So i think i might have come up with some sort of solution, but needs some expert tuning.
    Take a look at the following code.
    !/usr/bin/perl use strict; use warnings; my @tags = qw( 8 9 35 50 97 57 34 49 56 43 52 200 207 40 55 11 167 54 +59 44 21 38 60 1 10); my $reg_ex = join( '|', @tags ); open(FH, "test.log")||die("Unable to open log file: $! \n"); while(<FH>) { printf("Working on String : $_ \n"); if( /\[(.*)\]/) { printf("New String: <$1> \n"); my @vals = split(/(8=|9=)/, $1); foreach my $l (@vals) { printf("$l\n"); } } }
    This spits out.
    chimi:~/programs/perlweb/FIXRead cuthbe$ perl t.pl Working on String : 2005/11/18 00:06:49:875: FIXPump: Received data on + connection {OBMSCNX} [8=FIX.4.29=040435=849=EXLINK256=DB_ORDER50=DES +RISKGATEWAY57=DCN3230134=4045052=20051118-05:06:491=ATOP116=0.0000000 +011=DES:fud630_2005111814=15.000017=0131730433520=031=138.0800000032= +15.000037=131726062238=15.000039=254=155=CibntractZ60=20051118-05:06: +49150=2151=values=13173047101317260622109=DCN3230163=0167=F00=2005122 +07=T40=244=138.080000005113=06556=20051117-23:06:4610=230] New String: <8=FIX.4.29=040435=849=EXLINK256=DB_ORDER50=DESRISKGATEWAY +57=DCN3230134=4045052=20051118-05:06:491=ATOP116=0.0000000011=DES:fud +630_2005111814=15.000017=0131730433520=031=138.0800000032=15.000037=1 +31726062238=15.000039=254=155=CibntractZ60=2051118-05:06:49150=2151=v +alues=13173047101317260622109=DCN3230163=0167=F200=200512207=T40=244= +138.080000005113=06556=20051117-23:06:4610=230> 8= FIX.4.2 9= 040435=84 9= EXLINK256=DB_ORDER50=DESRISKGATEWAY57=DCN3230134=4045052=20051118-05:0 +6:491=ATO16=0.0000000011=DES:fud630_2005111814=15.000017=013173043352 +0=031=1300000032=15.000037=13172606223 8= 15.00003 9= 254=155=CibntractZ60=20051118-05:06:49150=2151=values=1317304710131726 +062210 9= DCN3230163=0167=F00=200512207=TSE40=244=138.080000005113=06556=2005111 +7-23:06:4610=230
    So i can see that if i put in the values into the split then it will pass them out,and then i should be able to grab them so first value would be the tag and then second would be the info.
    Question is how do i get the split to do each tag that i need to search and more if need be.