String manipulation - Sort String to DT

Hi All,

I have several strings coming from PDF, I want to sort such strings and put it into DT

Input

str = Royal Denson Short Term Mkt Y Acc 2.00 0.10 USD Money Market - Short Term

Output

Note- string text could be dynamic

@ppr @Yoichi

Thanks
Rishi

Hi @rishiathawale

Use the below regex in assign activity

Name = System.Text.RegularExpressions.Regex.Match(Input,"[A-Za-z]+.*(?=\s+\d+\.\d+\s+\d+\.\d+)").Value

Price = System.Text.RegularExpressions.Regex.Match(Input,"\d+\.\d+(?=\s+\d+\.\d+)").Value

Rev = System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+\.\d+\s+)(\d+\.\d+)").Value

Market = System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+\.\d+\s+\d+\.\d+\s+)(.*)").Value


Regards

Hi @rishiathawale

Check out the below flow:
=> Use Build Data Table to create the columns and output is dt.
image
=> Given input:

Input= "Royal Denson Short Term Mkt Y Acc 2.00 0.10 USD Money Market - Short Term"

=> Use below all syntaxes in Assign acitvity:

Name= System.Text.RegularExpressions.Regex.Match(Input,"[A-Za-z]+.*(?=\s+\d+\.\d+\s+\d+\.\d+)").Value
Price= System.Text.RegularExpressions.Regex.Match(Input,"\d+\.\d+(?=\s+\d+\.\d+)").Value
Rev= System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+\.\d+\s+)(\d+\.\d+)").Value
Market= System.Text.RegularExpressions.Regex.Match(Input,"(?<=\d+\.\d+\s+\d+\.\d+\s+)(.*)").Value

=> Use Add Data Row acitivity

Array Row -> {Name,Price,Rev,Market}
DataTable -> dt

=> Use Write Range Workbook to write back to excel.
Workflow:

xaml:
Sequence1.xaml (12.1 KB)

Output:

Regards

1 Like

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