I need to extract a particular number from row value using regex

Input : {“DynamicProperties”:{“CompanyCode”:“5405”,“DocumentNumber”:“3900005542”,“InvoiceReferenceNumber”:“000001731-1”,“Supplier”:“6000009”,“Operation Type”:“Park Invoice”}}

Output : 3900005542

How to get this output?

the input looks like a JSON string and therefore we recommend to use JSON oriented approaches instead of Regex:

The image shows the inspection of a JSON string parsed into a JObject in the Immediate window, where the "DocumentNumber" value is extracted and displayed as "3900005542". (Captioned by AI)

UPD1 - added hint:
in Addition to above:

kindly note the nested structure and the need of using
myJObject → (“DynamicProperties”) ← (“DocumentNumber”).Value(Of String)

1 Like

regex.xlsx (10.5 KB)
This is the input excel file .In this need to refer column “Specific data” . I need to extract the number and paste it in the column H “document number” column.Can you create workflow using deseralize json as you suggested

would be the same approach

  • for each row in datatable | currrentRow in YourDataTableVar
    • Assign Activity: strJson = currrentRow(“SpecificData”).toString.Trim
    • Assign Activity: currrentRow(“Document number”) =
Newtonsoft.Json.Linq.JObject.Parse(strJson)("DynamicProperties")("DocumentNumber").Value(Of String)

fee free to prototype it within the immediate panel
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum

Thanks for your help.

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