java.util.regex question
From: Calum MacLean (cnmaclean_at_hotmail.com)
Date: 11/28/03
- Previous message: Alex Hunsley: "Re: map two data structure"
- Next in thread: Thomas Schodt: "Re: java.util.regex question"
- Reply: Thomas Schodt: "Re: java.util.regex question"
- Reply: Thomas Schodt: "Re: java.util.regex question"
- Reply: J. Chris Tilton: "Re: java.util.regex question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: Alex Hunsley: "Re: map two data structure"
- Next in thread: Thomas Schodt: "Re: java.util.regex question"
- Reply: Thomas Schodt: "Re: java.util.regex question"
- Reply: Thomas Schodt: "Re: java.util.regex question"
- Reply: J. Chris Tilton: "Re: java.util.regex question"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]