Reputation: 65
I have the following string and I just want to extract "My Important Text".
cssbody=[short_bdy] cssheader=[short_hdr] body=[My Important Text] offsetx=[10] offsety=[20] delay=[300]
Upvotes: 0
Views: 132
Reputation: 521457
We can try using re.findall
with the pattern:
\bbody=\[(.*?)\]
Script:
inp = "cssbody=[short_bdy] cssheader=[short_hdr] body=[My Important Text] offsetx=[10] offsety=[20] delay=[300]"
matches = re.findall(r'\bbody=\[(.*?)\]', inp)
print(matches[0])
This prints:
My Important Text
Upvotes: 1