开发者

regular expression part of URL extract

need a little help with extracting part of the URL via regex

I have URL which looks like this:

http://www.something.com/offer/1/all-[part to be extracted]-offers-discounts

First parameter is static/fixed (/offer/开发者_如何学编程), second one is number variable (/1/) which is in range of x-xxxxx.

This needs to be 301 redirected to: http://www.something.com/[part to be extracted]


http://www.something.com/offer/\d+/all-(.*)-offers-discounts

redirect to

http://www.something.com/$1


Split the Incoming url on "/" if using Java use string.split() take the last index of the returned array in a variable say resultSplit, again split resultSplit on "-" take the second index from the result array and use it for redirection on the new url.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜