Split String(Getting the specified ID)

Hi All,

Good Afternoon.

I want to split a string which is in a column
“23082021 71091210823647971 SPM DEP”
"SET65191210821263463 EMI COLL 20210821 "
In the both cases I need to fetch only the word starting with
SET-“SET65191210821263463” &“SET65191210821263463”
I tried with substring function but it is not giving the
correct output. Can anyone help me to resolve the same.


Thanks,
Naveen Kumar S

@HeartCatcher

Try below Regular expression to fetch the string which is started with SET.

Hi @lakshman,

Thanks for your reply its working If the set is Capital letter(SET), but if the set value(Set).
i.e. 1. "SET65191210821263463 EMI COLL 20210821 " its working fine for this.
2."23082021 Set50572210823168873 SPM DEP
" , showing blank for this.

please do needful

@HeartCatcher

Use RegexOptions.IgnoreCase in your Regular expression to ignore the case.

1 Like

Hi @lakshman


I used the above regex expression but when I run in for Loop I am getting the only one value from the list of value

Hello

I think side you problem.

Try “Regex.Matches” instead of “Regex.Match”

Cheers

Please see attached file:
Sequence33.xaml (7.6 KB)

@lakshman

HI @Dawodm,
I tried and I did the modify according to my project but I am getting an error as in the attachment please do help

Your variable is from type char. You need to adjust it to string

@HeartCatcher - May I ask why are you using For each loop here ?

If your string is in excel sheet you should be running for each row for the datatable and read each row and apply the regex.match …

   Regex.match(row(columnname).tostring, your pattern)

If you want the result to be in column B…create the column first and then add the output to that column

1 Like

Hi @prasath17,
thanks for your reply.
Actually the scenario is I want take a column and apply regex to that column in for each row.
I am doing like this.
1.Read the excel(DT1)
2.For each row (DT1)
3. Get row item (ID)
4. Then I pass the get row item output inside matches activity.
5. At the end I am displaying the output in for each loop(but I am getting only one value)
6.The output to be write in one column.

Book1.xlsx (23.3 KB)

Its done but the output is not coming in for each

What do you mean exactly?

I meant that I passed the read excel output(DT1), in for each then selected a column using get row item, the output of the get row item is passing to the matches activity as input , then I passed the output of the matches in For each activity at the end I am trying to display the output but I am getting empty instead the regex value

@HeartCatcher - looks like your logic is not correct here .

I guess you are trying to save all the results and right to the output column right ? Please confirm.


as in the attachment

@prasath17 ,
Perfect