Can you tell me how to match the data in this section of data?

use regular matching in python to match the following data, including imageBase from imageBase to};

data="
imageBase = {

    PIC_DIR   : "E:/ttt/ttt/test/",

    PIC_PATH  : "E:/tt/ttt/test",

    SUB_DIR   : "",

    LOCATION  : "",

    DLL_PRIV  : "0"

};

"

import re
patten=re.compile ("^ imageBase (. *)}; $")
res=patten.findall (data)
print (res)
this is my way of writing, but it"s always empty

.
Mar.10,2021

I don't know if it's what you want:

import re
data= "\
imageBase = {\
    PIC_DIR   : 'E:/ttt/ttt/test/',\
    PIC_PATH  : 'E:/tt/ttt/test',\
    SUB_DIR   : '',\
    LOCATION  : '',\
    DLL_PRIV  : '0'\
};"
patten=re.compile('^imageBase\s=\s(.*);$')
res=patten.findall(data)
print(res[0])

-sharp 
{    PIC_DIR   : 'E:/ttt/ttt/test/',    PIC_PATH  : 'E:/tt/ttt/test',    SUB_DIR
: '',    LOCATION  : '',    DLL_PRIV  : '0'}
Menu