Java Regex Date Vaidate parseDate(String text)

Here you can find the source of parseDate(String text)

Description

parse Date

License

Apache License

Declaration

public static String parseDate(String text) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main {

    public static String parseDate(String text) {
        String regex = "(\\d{4}[-|\\/]\\d{1,2}[-|\\/]\\d{1,2})";
        Pattern p = Pattern.compile(regex);
        Matcher m = p.matcher(text);
        while (m.find()) {
            return m.group();
        }//from w  ww .j a  v  a2  s.co m

        return "";
    }
}

Related

  1. dateToString(Date date)
  2. parseDate(final String date, final DateTimeFormatter parser)
  3. parseDate(String date)
  4. parseDate(String dateStr)
  5. parseDate(String entry)
  6. parseDateDiff(final String time)
  7. parseDateDiff(String time)
  8. parseDateDiff(String time, boolean future)
  9. parseDateOffset(String time)