IMPORTANT: String manipulation with some specific case

If a Email Subject looks like

Action Needed: PO1:13213, PO2:123123123,123123

I always want to extract the data of PO1

any idea or suggestions kindly needed ASAP

1 Like

Hi

If the input is Ina string variable named strinput

Then use a assign activity with a regex expression like this

Stroutput = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?<=PO1:).*(?=,\nPO2|,PO2)”).ToString

Cheers @suryasuhas527

1 Like

Hi @suryasuhas527

Is it working

HI @Palaniyappan , i have tried that regex for the example:

PO1: 176953, PO2: 9030664034, 10827494013099

its not working… as per your solution i have used and if i try to print the value of Stroutput its coming as blank…

Hi @suryasuhas527

How about this regex

Thanks,

Hi @Boopathi.M
Thanks for the regex but there is one limitation with your regex it will take only Integer formats but actually here is my requirement it has to satisfy all these points.

Case1–>PO1: 176953, PO2: 9030664034, 10827494013099
Case2–>PO1: 177124, 10827493996564
Case3–>PO1: 176211A, PO2: 9030607163, 10827492656093
Case4–>PO1: N/A, PO2: 9030595082, 10827492379963
Case5–>PO1: N/A, 10827491557581
Case6–>PO1: 20043484, 10827491248597
Case7–>FW: Action Needed - PO1: 172928 PO2: 9030216348 10827481357964

Is that possible to get a Regex to satisfy to all these cases…?

Hi @suryasuhas527

You can replace comma or any extra space at the end.

Thanks,