Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

extracting a code(of variable length) after a character and before a string

I have URLs like the following that I need to extract the code after the last '/' and before the '-4.html' in the load script

/history/2/52557-4.html   -> want to return 52557

/abc/xyz/11/3-4.html       -> want to return 3

I tried: TextBetween(MyString,'/','-4.html')  and it's returning the text between the first '/' rather than the last.

I also tried: TextBetween(right(MyString,15),'/','-4.html'), but since the code can be variable length, I'm not sure how to not capture other preceding '/' with the right() function.

Appreciate the help.

Thanks.

-Ming

1 Solution

Accepted Solutions
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi Ming,

Following should do the trick:

TextBetween(URL, '/', '-4', SubStringCount(URL, '/'))

View solution in original post

2 Replies
disqr_rm
Partner - Specialist III
Partner - Specialist III

Hi Ming,

Following should do the trick:

TextBetween(URL, '/', '-4', SubStringCount(URL, '/'))

Not applicable
Author

Thanks Rakesh, that worked perfectly.