I'm trying the below code to select the last part of the URL:
select 'http://www.XX.com/download/apple-Selection-products/beauty-soap-ICs' , field_1[0].string
from
(
select SPLIT('([^\/]+$)', 'http://www.XX.com/download/apple-Selection-products/beauty-soap-ICs')field_1
)
However, my result isn't coming as expected.
http://www.XX.com/download/apple-Selection-products/beauty-soap-ICs
result should be :
beauty-soap-ICs
but I'm getting Wrong Result.
Any help will be appreciated. The URL can and can't end in a /.
You can use the
REGEXPfunction here:See the regex demo
Details:
.*- any zero or more chars other than line break chars as many as possible/- a/char([^/]+)- Group 1 ($1refers to this group value)" one or more chars other than//?- an optional/char$- end of string.