Extracting string between a text

Hi ,

I want to extract a string in between a below text
“Duration is :55 seconds for loading”
I want to extract 55 from the above .Can someone help

@karthik_kulkarni1

You can use Regex for this

system.Text.RegularExpressions.Regex.Match(“Duration is :55 seconds for loading”,“\d+”).Value

If you expect only one number will be there in the string

Hope this may help you

Thanks

I need to extract in between Duration and seconds.

@karthik_kulkarni1

Okay then use as below

system.Text.RegularExpressions.Regex.Match(“Duration is :55 seconds for loading”,“(?<=Duration is :).+(?=seconds)”).Value.Trim

Hope this may help you

Thanks

Thanks its working

1 Like

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