Please help me on this

Can someone let me know how to extract string between ‘_’ and ‘. xlss’ from the below example.

Invoice_00ABCD.xlss

I need 00ABCD only, no matter how many characters are there in middle of ‘_’ and ‘.xlss’

Please suggest.

1 Like

Can you try assign activity with System.text.regularexpressions.regex.match(“your string”,"_(.*).xlss$").groups(1).tostring
image

Hi

Welcome back to UiPath forum
If your input is in a string variable named Strinput
Then use a assign activity and mention the below expression

Stroutput = Split(Split(Strinput.ToString,”.”)(0),”_”)(1).ToString.Trim

Hope this would help you resolve this

@Raj_Sekhar

1 Like

@Raj_Sekhar

Let’s say inputString =“Invoice_00ABCD.xlss”

            outputString = inputString.Split("_"c)(1).Split("."c)(0).Trim

Hi @Raj_Sekhar

This will be another approach,

strText - your input string

strText.Substring(strText.indexof("_")+1,(strText.Indexof(".xlss")-strText.indexof("_"))-1)

Thanks

Thank you it worked

Thanks @lakshman

@Raj_Sekhar

Glad I could help. Happy Automation :grinning: