Get String of Particular Format from String

I want to Extract Invoice Number from pdf.
To get pdf data I use read Pdf activity, which works fine.
The problem is the lenght of invoice number id not fixed.
Example :
String : “Labour and Services Labour Invoice N14036G201951574\r\n\r\n1 A10AAGM02WSC Only washing and cleaning”

I want N14036G201951574 from this string but sometimes the

string is “Labour and Services Labour Invoice N1403r\n\r\n1 A10AAGM02WSC Only washing and cleaning”

But One thing is fixed in string which is invoice number starts with N1403

How can I get the Invoice number ?

you can use Regex to find the Invoice number…
try below…

log message = System.Text.RegularExpression.Regex.Match(stringVariable,"N1403.*?[\\]")
Result = N14036G201951574\

—once after reading the pdf with read pdf ocr use a assign activity like this
Str_input = String.Join(Environment.Newline,str_input.Split(Environment.NewLine.ToArray(),Stringsplitoptions.RemoveEmptyEntries))
Now use another assign activity like this to get the invoice number

Str_invoice = System.Text.RegularExpressions.Regex.Match(str_input,”N1403.*”).ToString .Trim

Where Str_invoice is a variable of type string
Cheers @RishabhMathur