Extracting text from text file

Hi Please find the below text and in it i need to extract Invoice no : IN-1577895544755.please help on it

DinoStorePleasesendpaymentsat
ACCOUNT:65575663784
IBAN:US99WER7269456
227CobblestoneRoad|30000Bedrock,NJSWIFT:BQWERROA324
PayPal:Test@paybil.com
INVOICE
IN-1577895544755
Client:
TOMTESTIssuedate:4/16/2020
222RockyWayNetdays:21
30000Bedrock,CobblestoneAveCurrency:USD
LAP.O.33/200-4
Item&DescriptionQuantityPriceLinetotal
FrozenBeans4100400.00
EnergyDrinks2170340.00
SUBTOTAL740.00
TAX10%74.00
TOTAL14.00
PayinvoicewithPayPal
I
Notes:
Fred,thankyouverymuch.Wereallyappreciateyourbusiness.
Getyourinvoicespaidfasterwithinvoicebus.com

Hi @deepak_raj,

Try this regex pattern —> "(?=IN-).*(?=\n)" in assign activity as given below,

Text1 = System.Text.RegularExpressions.Regex.Match(InputText,"(?=IN-).*(?=\n)").Value

here,
Text1 - String type (Output) & InputText - String var with input text.
So by this regex pattern it’ll look for IN- and text behind it.

image

here, you can try and learn more about regular expressions, https://regex101.com/r/c542SW/1/

1 Like

Hi @deepak_raj

just like @samir mentioned try regex. My pattern is slightly different. I assume you always have an Invoice number with 13 digits. “(?:IN-)*\d{13}” You can simply try out which pattern suites you most.

cheers,
Timo

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.