I try to use regular expression to capture data group from below logs. The pattern is
<item> : <key> = <value> , <key> = <value>, ..., <key> = <value>
([#\w\d]*?)[\s]*=[\s]*([.\w\d]*)
can capture group <key>
and group <value>
but i want to capture the <item>
group as well, so i group the above and repeat using {n}.
([\w]*):([\s]*(([#\w\d]*?)[\s]*=[\s]*([.\w\d]*)),*){1,}
20141207,07:15:52,0,>>RATIO: casher#=30, Value=2.579,Units=ratio,Error=N 20141207,07:15:52,0,>>RATIO: casher#=31, Value=4.509,Units=ratio,Error=N 20141207,07:15:52,0,>>RATIO: casher#=32, Value=3.735,Units=ratio,Error=N 20141207,07:15:52,0,>>RATIO: casher#=33, Value=2.401,Units=ratio,Error=N
20141207,07:15:52,0,>>CUSTOMER: casher#=30, Value=50,Units= count 20141207,07:15:52,0,>>CUSTOMER: casher#=31, Value=6,Units= count 20141207,07:15:52,0,>>CUSTOMER: casher#=32, Value=88,Units= count 20141207,07:15:52,0,>>CUSTOMER: casher#=33, Value=33,Units= count
obviously the result is not what is expecting. can anybody give me some tips? i am using python eventually to translate to code. thank you.
key=value
pairs with a single regex. Not in separate groups, anyway.