Hi @lisa_R ,
Could you maybe try the below Suggestion :
- As the Multiple Capturing data is present within the same whole text, We can use the Split Method and Separate each section and then use the Title and Depression Regex to capture the data.
System.Text.RegularExpressions.Regex.Split(strInput1,"(?=Title:)" )
Here, strInput1
is a string variable containing the whole text data. The output from the above expression is an Array of String, which we can use it to loop through a For Each
Loop Activity.
- Using the Expression above in the
For Each
Loop activity is shown below. We then Capture the Title and Description for each splitted Section.
Expressions to Capture Title and Description :
title = System.Text.RegularExpressions.Regex.Match(currentItem,"(?<=Title:).*").Value.ToString.Trim
Description = System.Text.RegularExpressions.Regex.Match(currentItem,"(?<=Description:)[\s\S]+").Value.ToString.Trim
-
Next, we add this data to the Datatable using
Add Data Row
Activity.
-
At the end, Outside the
For Each
Loop, we can use Write Range Activity and write the datatable to an Excel sheet.
Note: The NormalDT
used was built at the start using the Build Datatable
Activity containing the columns Title
and Description