How to write a regular expression if you want to get a string of getcolsum (xxx) in a string?

java wrote a rule himself. You can"t verify a character such as three arbitrary characters, (xx) at the beginning of getcol.

    String str = "798>getcolsum(fmoney)>getcolavg(fmoney)";
    String pattern = "getcol[\\w]{3}\\([\\w.]*\\)";

    Pattern r = Pattern.compile(pattern);
    Matcher m = r.matcher(str);
    System.out.println(m.matches());
How should I write this expression?


 String str = "798>getcolsum(fmoney)>getcolavg(fmoney)";
            String pattern = "getcol\\w{3}\\([\\w.]*\\)";
            Matcher m  = Pattern.compile(pattern).matcher(str);
            List<String> result=new ArrayList<String>();
            while(m.find()){
                result.add(m.group());
            }
Menu