here’s my code:
String t1="postby <span title=\"2011-4-5 17:22\">yesterday 17:22</span>";
String t2="postby 2010-11-12 10:02";
I want get 2011-4-5 17:22 , 2010-11-12 10:02 from t1 or t2,using one regex expression
(input t1 or t2,output the date)
how to do? (please give to me some example code,thanks)
A few notes:
String pattern = "\\d{4}-\\d{1,2}....."\dmeans “digit” (0-9){x}means “x times”{x,y}means “at least x, but not more than y times”Reference:
java.util.regex.Pattern