Extracting invoice number using regex

how can i extract invoice number using regex in below mentioned text

621911234 N. STATE HFRTWY 1761
IERTRVTTING, TERX 75038
INVOICE
DATE
INVOICE #
1/5/2020
13882
SHIP TO
JFFWEK 13713-309602
BLFRTDG 139 JTTFK INTERNATIONAL
JERTAMAICA, NTTY 11430

Hi,

Hope the following expression helps ypu.

System.Text.RegularExpressions.Regex.Match(strData,"^\d+$",System.Text.RegularExpressions.RegexOptions.Multiline).Value

or

System.Text.RegularExpressions.Regex.Match(strData,"(?<=INVOICE #[\r\n]+.+[\r\n]+)\d+").Value

Regards,

1 Like