#!/usr/bin/python
 import re
 
 dic = {
     8:"Beg",
     9:"Acc",
     35:"Tex1",
     49:"tex2",
     52:"date",
     10:"CRC"
     }
 text ="8=FIX.4.4|9=56|35=0|49=CLIENT|56=BROKER|34=19|52=20090903-08:16:56.387|10=167n8=FIX.4.4|9=56|35=0|49=CLIENT|56=BROKER|34=19"
 # need to change first value to dictionary value
 new_text = re.sub("|(d+)=", "|" + dic["1"] + "=", text)

Add a code snippet to your website: www.paste.org