From: Tom Tromey <[EMAIL PROTECTED]>
Date: 31 Jul 2006 12:16:51 -0400
> It should return true if more input could possibly satisfy the regular
> expression.
>
> Eg consider the expression "bbba+". If the buffer contains "bbb",
> then hitEnd should return true -- if we read more data we might
> possibly match this expression. But if the buffer contained "maude",
> then hitEnd would return false.
Sun's hitEnd will return true for the latter case.
Running the following on Sun's JDK, I have got some idea of hitEnd.
bash$ cat TestHitEnd.java
import java.util.regex.*;
public class TestHitEnd {
public static void main(String[] args) {
Pattern p = Pattern.compile(args[0]);
Matcher m = p.matcher(args[1]);
m.find();
System.out.println("m=" + m + " hitEnd()=" + m.hitEnd());
}
}
bash$ java TestHitEnd 'bbba+' bbb
m=java.util.regex.Matcher[pattern=bbba+ region=0,3 lastmatch=] hitEnd()=true
bash$ java TestHitEnd 'bbba+' bbbaaa
m=java.util.regex.Matcher[pattern=bbba+ region=0,6 lastmatch=bbbaaa]
hitEnd()=true
bash$ java TestHitEnd 'bbba+' bbbaaaxxx
m=java.util.regex.Matcher[pattern=bbba+ region=0,9 lastmatch=bbbaaa]
hitEnd()=false
bash$ java TestHitEnd 'bbba+' maude
m=java.util.regex.Matcher[pattern=bbba+ region=0,5 lastmatch=] hitEnd()=true