I am trying to use regex to capture text that comes after a certain phrase. The information after the phrase can be either in a strait line or in a paragraph format. Below is an example.
Service For 12345 apple street Tampa,FL 34567
Or
Service For
12345 apple street
Tampa,FL 34567
So, I am trying to find a regex expression that will work for both because it is unsure which kind of format will be given.
@Sahil_J_Patel - Please check this.
My only concern is if the address comes only 2 line…this code will capture the 3 line too…if you have blank that is fine, if not then we need to see…
or try using Adrian’s code , in the Regex builder you just have to choose Single Line …but i guess his code will also capture the 3rd Line…
I am thinking of it now…but until then please proceed with my new code…
Okay makes sense. My final question is on extracting a number. If the keywords are for example amount due, amount, balance due and balance and I want to extract the number after those keywords how would I do so? Examples would be like
Total amount due [random number of spaces] $25.29
Total balance due [random number of spaces] $58.12
(?<=(Total amount due|Total balance due|Amount due|Pay this amount).*)\r?\n?\r?\n?([\$\d.,]+)$
Note: Above one works in Regular Regex Matches I can take Group2 output and prints it. But I am not sure, how we can make it work in Regex based extractor, I hope it should work. you can play around by removing each texts and you can see the amount captured in the group2.