当前位置: 代码迷 >> J2EE >> 劳驾各位写个正则表达式
  详细解决方案

劳驾各位写个正则表达式

热度:96   发布时间:2016-04-22 00:39:46.0
麻烦各位写个正则表达式
<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));    }