100分求一个正则表达式,在线等
原来有个写好的正则表达
RewriteRule /list/([^/]*) /mz/searchList\.jsp\?pname=$1 [L,PT]
是将 http://www.xxx.com/list/aa
解析到 http://www.xxx.com/mz/searchList.jsp?pname=aa
现在有一个网页 http://www.xxx.com/music/list/aa
也给转向到 http://www.xxx.com/mz/searchList.jsp?pname=aa
我希望url中如果是 /music/list 跳转到 http://www.xxx.com
应该如何做?
换一种说法就是通过一个正则表达式:只解析不包含 /music/list 这个串的
------解决方案--------------------这个支持正向预查吧?
RewriteRule (?!music)/list/([^/]*) /mz/searchList\.jsp\?pname=$1 [L,PT]
------解决方案-------------------- <script type= "text/javascript ">
var s = [ 'http://www.xxx.com/list/aa ', 'http://www.xxx.com/music/list/aa '].join( "\n ");
var p = /^(http:\/\/www\.xxx\.com\/)(?!music\/)(?:[^\/]+\/)?list\/(.*)/ig;
alert(s.replace(p, "$1\mz\/searchList\.jsp\?pname=$2 "));
</script>
------解决方案--------------------jf, thanks
http://community.csdn.net/Expert/TopicView.asp?id=5565891