Extract last part of string while keep changing

I have this string 1m3s49s53s1m4s1m0s2m27s

its like a time and i want to extract last time but sometimes last time like 2m27s and sometimes only 27s

how to archive that

Also the numbers always changing

Hi,

If second part always exists, the following will work.

System.Text.RegularExpressions.Regex.Match(yourString,"(\d+m)?\d+s$").Value

image

Regards,

Hey @rawanghurab1

  • Assign β†’ Output = System.Text.RegularExpressions.Regex.Matches(Input.toString, β€œ(\d+m)?\d+s?”).Cast(Of Match)().Last.toString

Regards,
Ajay Mishra

1 Like

Thankyou so much It’s Working

Hi @rawanghurab1

It will work for your condition,

- Assign -> Input = "1m53s1m38s1m47s1m3s49s53s1m4s1m0s2m27s"

- Assign -> Output = System.Text.RegularExpressions.Regex.Matches(Input.toString, "\d+m?\d+s?").Cast(Of Match)().Last.toString

Check the below workflow for better understanding,

Hope it helps!!