How to replace digit part between two pipes

I have string with columns seperated with pipe(|) and want to replace part of string where only nunbers or digits found between two pipe.
Note: if any - or anything appear between numbers then it should ignore them just check only numbers between two pipes.

For e.g.
Input:

Abc|01-10-2021|abch6788|98700056335336|Mumbai|Tx45772937|004678837|Rx567|0076|Received|

Output:
Abc|01-10-2021|abch6788|'98700056335336|Mumbai|Tx45772937|'004678837|Rx567|'0076|Received|

Output should replace |98700056335336| with |'98700056335336| same for other |'004678837| and |'0076|.

Note: if any other for e.g. |01-10-2021| this involved which contains - then ignore this case.

Hi @Mansi_Mhatre ,

Could you give this try?

image

System.Text.RegularExpressions.Regex.Replace(str_variable,"(?<=\|)\b(?=\d+\|)","'")

Kind Regards,
Ashwin A.K

Hi @Mansi_Mhatre

Use Assign activity

LHS → Create an variable
RHS → System.Text.RegularExpressions.Regex.Replace(InputString,"(?<=\|)(?=\d+\|)","'").Tostring

Regards
Gokul

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