//    tokenTest.java by Steven R. Brandt
//    <p>
//    An example file explaining how to use
//    com.stevesoft.pat, com.stevesoft.pat.wrap,
//    and com.stevesoft.pat.apps
//    <p>
//    This software comes without express or implied warranty.
//    No claim is made about the suitability of this software for
//    any purpose and neither I nor SteveSoft shall be liable for
//    damages suffered by the user of this software.
import com.stevesoft.pat.*;

class tokenTest {
    public static void main(String[] arg) {
        // In this example the token list is
        // "field1", ":", "b", ":", "", ":", "entry c"
        // if the pattern had been ":" the token
        // list would have been:
        // "field1", "b", "", "entry c".
        // if the pattern had been ":+" the token
        // list would have been:
        // "field1" "b", "entry c"
        RegexTokenizer rt =
            new RegexTokenizer("field1:b::entry c","(:)");
        while(rt.hasMoreTokens())
            System.out.println(">>"+rt.nextToken()+"<<");

        // In this example we should get...
        // "f1", ":", "", "2:"
        rt = new RegexTokenizer("f1:f2:f3:f4","(:)");
        System.out.println(">>"+rt.nextToken()+"<<");
        System.out.println(">>"+rt.nextToken()+"<<");
        System.out.println(">>"+rt.nextToken("f")+"<<");
        System.out.println(">>"+rt.nextToken()+"<<");
    }
};
