absolute match offset

Dmitry Beransky <[email protected]> Tue, 08 Oct 2002 18:09:39 -0700
Newsgroups gmane.comp.jakarta.oro.user
Message-ID <[email protected]>
Hi folks,

In the process of evaluating the library I came across the following 
problem.  I use Awk* classes to search for patterns in a big (>100MB) 
file.  What I can't figure out is how to keep track of the matchs' absolute 
offsets (relative to the beginning of the file).  I guess, I don't quite 
understand the documentation.  I thought the following code will give me 
what I'm looking for:

       long offset = 0;
       while( awkMatcher.contains(input, pattern))
       {
          MatchResult result = awkMatcher.getMatch();
          offset += result.beginOffset(0);
          System.out.println( "Found match at " + offset );
       }

but when I go back to the file and check the offsets they don't correspond 
to the proper patterns.  Any help?


Thanks
Dmitry