日期:2014-05-19  浏览次数:20687 次

麻烦各位写个正则表达式
<html>
</head>
<body>
<div id="main" flowid="B0JNyhc2tjPglJs5">
<iframe border="0" marginwidth="0" framespacing="0" marginheight="0" src="to-preparation.do;WLS_HTTP_BRIDGE_PA18SHOP=PbPJpcgsmbJxNTGvMyMGnF41DQtc5hdnQGLWhR0SS2N6q25Z18Xc!-1972506560?provinceCode=320000&cityCode=320100&flowid=B0JNyhc2tjPglJs5" frameborder="0" noresize="noresize" scrolling="no" width="100%" height="700px" vspale="0" id="childframe"></iframe>
</div>
</body>
</html>

能否帮忙匹配成to-preparation.do??provinceCode=320000&cityCode=320100&flowid=B0JNyhc2tjPglJs5
也就是src后面的WLS_HTTP_BRIDGE_PA18SHOP=PbPJpcgsmbJxNTGvMyMGnF41DQtc5hdnQGLWhR0SS2N6q25Z18Xc!-1972506560不要

------解决方案--------------------
Java code

      Pattern pp = Pattern.compile("(to-preparation.do).*(\\?provinceCode[^\"]*)");
      Matcher mmm =  pp.matcher("src=\"to-preparation.do;WLS_HTTP_BRIDGE_PA18SHOP=PbPJpcgsmbJxNTGvMyMGnF41DQtc5hdnQGLWhR0SS2N6q25Z18Xc!-1972506560?provinceCode=320000&cityCode=320100&flowid=B0JNyhc2tjPglJs5\" frameborder=\"0\" noresize=\"noresize\" scrolling=\"no\" width=\"100%\"");
    while(mmm.find()){
         System.out.println(mmm.group(1)+mmm.group(2));
    }