求一个JAVA正则表达示

Java正则表达式:字符串"CPU"后边加一个未知的0-9的数字
比如CPU2,CPU1

只要写出JAVA实现立刻给分。。。谢谢了

[code="java"]
public static void main(String[] args) {

    String row="rrrrCPU0rrrrrrr";
    String reg="CPU[0-9]"; 
    Pattern p = Pattern.compile(reg); 
            Matcher m = p.matcher(row); 
            while (m.find()) { 
                String s0 = m.group(); 

    String time = row.substring(row.indexOf(s0)+1,row.indexOf(s0 )+6);
    System.out.println(time);
            }
}

[/code]

CPU[0-9]

Pattern pattern = Pattern.compile("^CPU[0-9");
Matcher matcher = pattern.matcher("CPU1");
boolean b= matcher.matches();

刚少了个]
Pattern pattern = Pattern.compile("^CPU[0-9]");
Matcher matcher = pattern.matcher("CPU1");
boolean b= matcher.matches();

String reg="CPU[0-9]";
Pattern p = Pattern.compile(reg);
Matcher m = p.matcher("CPU0DDD");
while (m.find()) {
String s0 = m.group();
}

String value = "CPU1";
System.out.println(value.matches("^CPU[0-9]$".toString()));

String time = row.substring(row.indexOf("CPU[0-9]")+1,row.indexOf("CPU[0-9]")+6);
正则表达式不能够这样用啊
你的意思是 要取row第一次出现符合CPU+数字的位置???