Retrieve specific string and replace / with -

I am having a data table string.xlsx (8.4 KB) containing strings like :

High Sample Square 2X2 80 LINE HS WV
High Sample RCT 1’6X2 80 LINE HS WV
Rumts RCT 10X14 8/8 RWB ESK-93
Sample High Sample RCT 2X3 8/8 RWB ESK-91
High Sample Square 1’6X1’6 8/8 RWB ESK-624

I want to extract string and do changes like:

Square 2X2 80 LINE HS WV
RCT 1’6X2 80 LINE HS WV
10X14 8-8 RWB ESK-93
RCT 2X3 8-8 RWB ESK-91
Square 1’6X1’6 8-8 RWB ESK-624

Here, the strings are a combination of some features and the output i require is word earlier of ‘X’ and to replace / with -

image
Please help

1 Like

HI @Swara_Soni,

It may help you.

Regards
Balamurugan.S

Thanks @balupad14 for sharing the information but i my case i can replace / with - using the activity but how would i extract the required string .

Please help

1 Like

what do you mean word earlier of X
do you want to remove all the words before “Square” and “RCT”?

for example if input is High Sample Square 2X2 80 LINE HS WV
the output Square 2X2 80 LINE HS WV?

1 Like

Hello @Swara_Soni,

image

use this expression to extract the required string and use Add data Row activity too them into your excel.

Expression

(?<=High Sample |(RCT)).*

Cheers
@Swara_Soni

Hey @Swara_Soni,

Please check the below output, This should help you.

image

Code for ref - DT_ReplaceString.zip (23.7 KB)

This may help you. Logic behind the code is it will form a string starting from earlier word of X as you mentioned.

Thanks :slight_smile:

@Nithinkrishna Thanks for the solution, it worked on my actual case . Can i add a replace in the same workflow to replace / with -

1 Like

Hey @Swara_Soni, Extremely sorry for missing it.

Please add at the end, should work fine.

Thanks :slight_smile:

I added
System.Text.RegularExpressions.Regex.Replace(FinalString,"\/","-")

and it is working fine

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