4 Replies Latest reply: Nov 18, 2009 12:26 PM by 3004 RSS

    Count the number of occurences of a pattern in some files

    794113
      Hi,

      I am trying to extract some patterns in files using regex. I can easily extract the patterns using my program. I also wanted to count the number of occurences of the pattern in the files. For that I have written this code:
       int count=0;
                while (m.find())
                   
                   System.out.println("Found Patterns: "+m.group());
                   count++;
                   
             }
             System.out.println(count);  //giving error saying identifier expected
      Unfortunately I am getting an error saying identifier expected at the count line. What to do?

      Thanks