How to get a specfic text from a string

Hi Team,

I need to get the text- :20:SBI231228000220

Here it is the input text - ALRISALAA 0000000000PAY
{1:F01AJEAXXX4428502116}{2:O1990927231231JEAXXX44280581192312310927N}{3:{108:BESS21789599}}{4:
:20:SBI231228000220
:21:599FTIG233620005
:79:WE ACKNOWLEDGE .
5933620005 DATED /28/2023 .WE ARE
CURRENTLY INVESTIGATING THE INQUIRY AND WILL
REVERT VERY SOON.
KINDLY QUOTE OUR REFERENCE I231228000220 IN
FIELD 21 OF ALL YOUR FUTURE CORRESPONDENCE
RELATING TO THIS CASE.
THANKS AND KIND REGARDS
PAYMENTS OPERATION TEAM
HEAD OFFICE
-}{5:{CHK:B3473524E031}}

I tried regex code but its not working (?<=20:).*(?<=21:)

Hi @Thriesh_Naidu

Try this

@Thriesh_Naidu

Hi @Thriesh_Naidu

Use the below expression in assign activity

System.Text.RegularExpression.Regex.Match(Input.ToString,"(?<=20:)[\s\S]*?(?=.*21:)").Value

Hi @Thriesh_Naidu

Use the below regular expression to get the required output,

- Assign -> output = System.Text.regularexpressions.regex.Match(Input,"(?<=:20:)[\w\d]+(?=\n+:21:)").Value

Check the below image for better understanding,

Hope it helps!!

@Thriesh_Naidu
assign
str=System.Text.RegularExpressions.Regex.Match(str, “(:20:[A-Z0-9]+)”).Value

System.Text.RegularExpressions.Regex.Match(str, "(:20:[A-Z0-9]+)").Value

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