I'm doing some string manipulation and I'm very bad at regular expression. I have some string like:
/sonata-economy-analog-watch-men/p/itmda5wagvmtttwr
I want to replace everything before the last forward slash by a blank and get only "itmda5wagvmtttwr". Does anyone know how to do this with regular expressions?
Updated - Actually I'm doing this in xml.
let $url :=data($item//a[@class="fk-anchor-link"]/@href)
let $temp :=fn:substring-before($url, "?")
let $temp2 :=fn:replace()
In url I will get string as
/titan-htse-analog-watch-men/p/itmd9gjfprgdt8d8?pid=WATD9H76AMCWDYT5&ref=28b766fc-2692-4ba3-a4cb-ea8a060cc9ec
And using fn:substring-before($url, "?") I have taken everything before ? and in temp I'm getting,
/titan-htse-analog-watch-men/p/itmd9gjfprgdt8d8
Now I want to replace everything before last "/" and get only "itmd9gjfprgdt8d8" in temp2