We have the following text which represents the OCR output from an invoice. We need a regex that determines the Order number and invoice number. They are on consecutive lines and always just under the Total Invoice line. See below bold.
Write a XAML to extract them in two string variables.
DEMO - Sliced Invoices
123 Somewhere Street
Your City AZ 12345 firstname.lastname@example.org
123 Somewhere St
Melbourne, VIC 3000 email@example.com Invoice Number
$85.00 Sub Total
Total Invoice INV-3337 12345
January 25, 2016
January 31, 2016
I didn’t need to generate the data table and then convert it back to text (which I had from the Get full text activity) but I think I was considering going through the data table one row at a time to start off with and then I remembered the regex code Clayton had done and also the challenge was about regex right!
Thanks for the compliment
One useful trick with Regex which I should have used in my post is “look-ahead” and “look-behind” (there is more info online)
"(?<=(abc))(.*)" //will pull everything AFTER "abc" not including "abc" "(.*)(?=(abc))" //will pull everything BEFORE "abc" not including "abc"
Also, using “((.|\n|\r)*)” will pull everyting including newline and carriage return