I have some text input and I want to extract few information from the text. For that, I am trying to use Regular Expression and am able to do that except for two fields- rent and transfer.
The input text is as below-
my_str = "19 Aug standing order rent Apolo Housing Assoc. 500.00 50.00
20 Aug transfer from John wick saving a/c 200.00 130.90"
Now I want to extract rent like- rent 500.00 and transfer as transfer 200.00 but somehow only 'rent' and 'transfer' keywords are extracting only.
Below is my code in Python for the same-
import re
find_rent = re.search(r"(rent)+([0-9,.]*)", my_str)
found = find_rent.group()
print(found)
With the above code, only 'rent' is extracted not 'rent 500.00'. Similar code I am using for transfer also.
Please guide me on what I am doing wrong here.