URGENT - Remove a part of a string

Hello all,
I got a dynamique input text string like the following :

https://abc.abcdefgh.com/blabla/1234567891011/StringStringString_Q12345_FirstNameLastName.pdf

i need help to remove the last part of my textn i mean that i want to delete all the text that it came just after the last Slash Bash : StringStringString_Q12345_FirstNameLastName.pdf
So the output should became like this :

https://abc.abcdefgh.com/blabla/1234567891011/

Hi,

Can you try the following?

System.Text.RegularExpressions.Regex.Replace(text,"[^/]*$","")

Regards,

@o.mustapha
as an alternate have a look here:

1 Like

If you don’t want to use Regex:

str = str.Substring(0, str.LastIndexOf("/")+1)
2 Likes

It works ! Thanks a lot.

1 Like

I’m facing another issue :
i have an input string like this after displaying it with a write line activity :
" \t\t\t\t\t\t \t\t\t\t\t\t \t\t\t\t\t\t \t \t \t\t\t\t \t\tAdditional credentials, to enter in specific popup box when prompted for authentication.username: in_usernamePassword: in_password \t\t \t\t\t\t\t \t\t\t\t\t \t\t\t \t\t\t \t\t\t \t\t\t\t \t\t\t\t \t\t\t"
and i would like te retrieve the in_username and the in_password in different variable
any help please…

Regards

Hi,

Your another problem seems solved in the following post, right?

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