Forum Discussion
luk
Boss
kiettuongwork there are several things you can try, I would do it as follows:
<#-- assuming URL: https://communitystg.digi.com.my/t5/Blog/bg-p/11112222 with the goal to extract the number at the end, e.g. 11112222 --> <#assign url = http.request.url /> <#-- first split away any URL parameters, that's the stuff after a question mark "?" what you seem to want is a url-path element, basically what we want is everything before a possible question mark --> <#assign urlparts = url?split("?")?first /> <#-- we then split that first part at every slash "/" --> <#assign urlparts = url?split("?")?first?split("/") /> <#-- and eventually select just the last bit of that sequence to get what you want --> <#assign urlparts = url?split("?")?first?split("/")?last /> <#-- of course you do not need to do that assignment 3 times, once is enough, e.g. like this: --> <#assign urlparts = url?split("?")?first?split("/")?last /> ${urlparts}
hope it helps!
PS: The link to your stage instance of Lithium is blocked by .htaccess, therefore nobody can see your demo-links
kiettuongwork
7 years agoContributor
I have tried them but could not work. You may need review my previous comments to see
Related Content
- 7 years ago
- 9 years ago