I am attempting to select part of a python string using re.match:
revenue = "Revenue;;Item,Johnver,Vanston,Danbree,Vansey,Mundyke;Tea,190,140,1926,14,143;Coffee,325,19,293,1491,162;Water,682,14,852,56,659;Milk,829,140,609,120,87;;Expenses;;Item,Johnver,Vanston,Danbree,Vansey,Mundyke;Tea,120,65,890,54,430;Coffee,300,10,23,802,235;Water,50,299,1290,12,145;Milk,67,254,89,129,76;;"
revenue = re.match(r"(?<=Revenue;;).*(?=;E)", file_content)
print(revenue)
but it returns None
.
I tested the regular expression on regex101.com, and it gave me the desired match, the text following Revenue;;
and preceding ;Expenses
:
Item,Johnver,Vanston,Danbree,Vansey,Mundyke;Tea,190,140,1926,14,143;Coffee,325,19,293,1491,162;Water,682,14,852,56,659;Milk,829,140,609,120,87;
Therefore I'm assuming something is wrong with my python implementation, however, I couldn't find any information in the python regex documentation that helped me. Tried with both python 2 and 3.
What could I be doing wrong