I don't have a code that needs solving, but merely a simple explanation if possible from an example in a book. There isn't much explaining and I just need to know how this line of code checks to make sure the date entered does not occur in April. The [0-35-9] is throwing me off.
One tricky part of the regex in the example is at .* part. If I remember correctly, by default regex matching will use greedy algorithm. In other words, it will keep looking for the pattern as far as it could after .* to match, not the first match it found.
String a = "Jane BD is 10-10-78";
String b = "Jane or Jone BD is 10-10-78 or 09-09-88";
Both string should be matched but the second string would match at 09-09-88 instead of
what you would expect it to match (at 10-10-78).
Stultuske: Your are right. I guess it should have been [1-35-9] if it is required to skip just april.
Actually if you look at the whole regex, it is correct to be [0-35-9] in the sense that it is the second digit of a month. However, the regex is flaw by itself (too simple) because it uses \d in place of where numbers may or may not be what they are (\d represents any digit of [0-9]).