Suppose you have a given text like below and you want to extract invoice No and date from given text, and invoice no and date is in middle of the text.
MAERSK LINE A/S INVOICE NO : SHVDA064505
ATT GROUP PROCUREMENT ESPLANADEN 52@ DATE : 27/89/2018
1263 COPENHAGEN DENMARK BILL FORM : SHBFN@38112
To Extract Invoice No Use the below Regular Expression
(?<=INVOICE NO :)(.+?)(?=\n)
(?<=INVOICE NO : ) - I have made INVOICE NO : as constant because this value doesn’t change
(.+?) - I am telling to take everything after the constant.
(?=\n) - Take the value before new line
To Extract Date use the below Regular expression :
The same thing as above.
You can use https://regex101.com/ to test this.
Try this out and let me know if you face any difficulties in understanding.