Regex for string delimiter - last "/"

Hi,

I need to get text before AND after last “/”. Here are some examples:
MILES AWAY/SALA RAZZMATAZ/Spain
Glovo Glovo/Spain
Microsoft/Austria

Any suggestions?
Thx and KR, Vanja

Hi @VanjaV

Can you try this

Input = "MILES AWAY/SALA RAZZMATAZ/Spain"
Value1 = System.Text.RegularExpressions.Regex.Matches(Input,"((?<=\/)\w+)").Last
Value2 = System.Text.RegularExpressions.Regex.Matches(Input,"(\w+(?=\/))").Last

Regards,

1 Like

Hi,

How about the following?

System.Text.RegularExpressions.Regex.Match(strData,"^.*(?=/[^/]*$)").Value
System.Text.RegularExpressions.Regex.Match(strData,"(?<=/)[^/]*$").Value

Regards,

1 Like

Hello @VanjaV,

PFA. You can use this workflow.

cmd_process.zip (2.5 KB)

1 Like

Hi @VanjaV

Use below,

fullText = “Microsoft/Austria”
beforeLastSlash = fullText.Substring(0, fullText.LastIndexOf(“/”))
afterLastSlash = fullText.Substring(fullText.LastIndexOf(“/”) + 1)

If helpful, mark as solution. Happy automation with UiPath

1 Like

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