Dim s As String = $"https://www.test.com/mysite/test.html"$
Dim result() As String = Regex.Split("/", s)
If result.Length > 0 Then
Log(result(result.Length - 1))
End If
Private s As String = "https://www.test.com/mysite/test.html"
Private i As Int
Private r As String
i = s.LastIndexOf("/")
r = s.SubString(i + 1)
Log(r)
other;
Last segment of the route before a possible query string
B4X:
Dim Text As String = $"https://www.test.com/mysite/test.html"$
Dim Pattern As String = $"\/([^\/?#]+)(?:[?#]|$)"$
Dim Matcher1 As Matcher = Regex.Matcher(Pattern,Text)
If Not (Matcher1.Find) Then Return
Log(Matcher1.Group(1))
SubName: GetFilename Description: Gets the Filename of Image or Page from Path Sub GetFilename(fullpath As String) As String Return fullpath.SubString(fullpath.LastIndexOf("/") + 1) End Sub ' ' Example Log(GetFilename("http://www.domain.tld/SomePage.html")) ' -> SomePage.html Tags...