java.util.regex question

From: Calum MacLean (cnmaclean_at_hotmail.com)
Date: 11/28/03

  • Next message: Thomas Schodt: "Re: java.util.regex question"
    Date: 28 Nov 2003 05:08:44 -0800
    
    

    I have the following code:

            Pattern pattern = Pattern.compile("1.*3");
            Matcher matcher = pattern.matcher("1234567890123");
            matcher.find();
            System.out.println(matcher.start() + " --> " + matcher.end());

    I would expect this to match just the first 3 characters. Instead, it
    matches all the characters. The following is the output:

    0 --> 13

    Is there any way I could get it to match just the 3 characters? Or
    does regex not work this way?

    Thanks,
    Calum


  • Next message: Thomas Schodt: "Re: java.util.regex question"