日期:2014-05-18  浏览次数:20666 次

正则表达式问题,帮忙看下,tks

public static void main(String[] args) {
 Pattern pattern = Pattern.compile("(?<=\\&\\$\\$\\$)[a-zA-Z]*(?=\\&\\$\\$\\$)");
        Matcher matcher = pattern.matcher("文本框&$$$userName&$$$用户名|$$$密码框&$$$userPassword&$$$密码|$$$登录按钮&$$$http://192.168.10.249:8081/app/login/login.do&$$$登陆url");
        if (matcher.find()) {
           System.out.println(matcher.group());
        }
}

我想要得到userName和userPassword两个字符串,这两个字符串都是字母组成。但我现在只能得到userName,不知道怎么回事
正则表达式

------解决方案--------------------
if换成while试试