Extracting 4 or more digit string from random string

Hello, I have a random string “tokvhjsln wvvev 26 aeer58 r5 5698erv drv”, and I would like to extract string that is at 4 numeric caracters long.
So the output for this exect string would be “5698”

You can use this expression on an assign activity

output = System.Text.RegularExpressions.Regex.Match(yourString, “\d{4}”).ToString

This uses Regex to extract a number with exactly 4 digits.


Hi @tomaz

Refer to the screenshot below!



1 Like

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