日期:2014-05-20  浏览次数:20751 次

提取数字问题
有字符串"http://www.aa.com/php/index.php?number=100&tag=100"

我想提取number=后面的数字该怎么提取亚

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

public static void main (String args[]) {
        String str = "http://www.aa.com/php/index.php?number=120&tag=100";
        int a = Integer.parseInt(str.replaceAll(".*number=(\\d+).*", "$1"));
        System.out.println(a);
    }

------解决方案--------------------
探讨

因为我是在一个文件中写入正则表达式,然后读取这个表达式,从给定的字符串中提取出number=后面的数字,可是我不知道这个正则表达式该怎么写