fork download
  1. import java.util.*;
  2. import java.lang.*;
  3. import java.io.*;
  4. import java.util.regex.*;
  5. class Ideone
  6. {
  7. public static void main (String[] args) throws java.lang.Exception
  8. {
  9. final String REGEX_DATE_FORMAT = "(?<!\\S)(\\d{1,2})([-./])(\\d{1,2})(\\2)(\\d{2}(?:\\d{2})?)(?![^\\s.])";
  10. String line = "After shopping 15.09.10";
  11. Pattern pattern = Pattern.compile(REGEX_DATE_FORMAT);
  12. Matcher matcher = pattern.matcher(line);
  13. int startIndex = 0;
  14. if (matcher.find(startIndex)) {
  15. System.out.println(true);
  16. System.out.println(matcher.group());
  17. }
  18. }
  19. }
Success #stdin #stdout 0.09s 27940KB
stdin
Standard input is empty
stdout
true
15.09.10