String Manipulation to get the number between

Hi,

I am receiving the following string: Sev 04/03/23 / 4 / DDP2

I want the number after the date i.e., 4. Another example is Sev 04/03/23 / 2 / DDP2. Here 2. Can someone write a one-liner for me to extract the number?

Thanks.

Hi @Umer_Shahid

What about the following?

System.Text.RegularExpressions.Regex.Match(strInput, "(?<=\/\s)\d+(?=\s\/)").Value

Regards!

Hey @Umer_Shahid

Here is another regex pattern which is ‘anchored’ on the date.

System.Text.RegularExpressions.Regex.Match(strInput, “(?<=\d{2}.\d{2}.\d{2} . )\d+”).Value
image

Hopefully this helps,

Cheers

Steve

Works. Thank you.

1 Like

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