1 // Fig. 29.24: RegexMatches.java
2 / Demonstrating Classes Pattern and Matcher.
3 import java.util.regex.Matcher;
4 import java.util.regex.Pattern;
5
6 public class RegexMatches
7 {
8 public static void main( String args[] )
9 {
10 // create regular expression
11 Pattern expression =
12 Pattern.compile( "J.*\\d[0-35-9]-
\\d\\d-\\d\\d" );
13
14 String string1 =
"Jane's Birthday is 05-12-75\n" +
15 "Dave's Birthday is 11-04-68\n" +
16 "John's Birthday is 04-28-73\n" +
17 "Joe's Birthday is 12-17-77";
18
19 // match regular expression to string and
print matches
20 Matcher matcher = expression.matcher(
string1 );
21
22 while ( matcher.find() )
23 System.out.println( matcher.group() );
24 } // end main
25 } // end class RegexMatches
I know what the code does...it matches a birthday in a given regular expression...what i just dont understand is line 12. what does the "[0-35-9]" in this line mean? thanks guys