Hi I need to extract the invoice number from the email subject which is generally at the end of the email subject.
For example: “Settlement Invoice: Xyz company 2023 final deal 653457”
Or
“ 653457 Settlement Invoice: Xyz company 2023 final deal ”
From above how do I need to extract the"653457" number only.
Thanks for the help
But this expression is only working if the invoice number is in the end of email subject not at the first. Can you please share what changes need to be done if the invoice number will be in the starting of the email subject also ?
Hm if there’s no fixed pattern to the invoice number, regular expressions won’t work. If you’re certain that the invoice number will always be the first word or the last word, perhaps splitting the email subject and fetching the first and / or the last word can be done. But you’ll still need to verify afterwards whether the word you’ve fetched is an invoice number or not.
Strings.Split("653457 Settlement Invoice: Xyz company 2023 final deal", " ").First or Strings.Split(“Settlement Invoice: Xyz company 2023 final deal 653457”).Last
Invoice number can be anything ranging from 2 digit to 8 digit then only this is gix either the invoice number will came at starting or at the end of the email subject.