-
Enhancement
-
Resolution: Fixed
-
P4
-
1.4.0
-
beta2
-
generic
-
generic
Name: yyT116575 Date: 06/15/2001
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b65)
Java HotSpot(TM) Client VM (build 1.4.0-beta-b65, mixed mode)
I am very happy to see regular experssions have finally turned up in JAVA but..
The very useful at times "\G" achor has not been included as a boundary matcher.
This is essential for tokenising where all characters in the string must be
accounted for nd \\G is used to force the match to start when the previous
match completed.
import java.io.*;
import java.net.*;
import java.util.*;
import java.util.regex.*;
class p {
public static void main ( String[] unused ) {
Pattern p = Pattern.compile( "\\G\\w+\\w*" );
Matcher m = p.matcher( "aab abbb cc" );
while ( m.find() ) {
System.out.println( m.group() );
}
}
}
(Review ID: 126697)
======================================================================