how to use regular expressions to extract href = "", " high speed .. death ", " 2013-09-29 " and other information
------ Solution -------- ------------------------------------
I date data type is data types , how to take ah
do not understand what you're saying ,
java.text.SimpleDateFormat
you take a look to this class it.
------ Solution ---------------------------------------- ----
landlord will not turn a string date ? give the landlord a bar code
SimpleDateFormat fm=new SimpleDateFormat("yyyy-MM-dd");
Date date=fm.parse("1979-12-12");
------ For reference only ----------------------------------- ----
demand response , and other online
------ For reference only -------------------------- -------------
String a = "<li><a href=\"?bid=2&did=0&eid=1227\">高速路上停车捡葫芦引发交通事故一人身亡</a><span>2013-09-29</span></li>";
Pattern p = Pattern.compile("<li><a href=\"([^\"]*)\"[^>?]*>([^<]*)</a><span>([^<]*)</span></li>",Pattern.DOTALL);
Matcher matcher = p.matcher(a);
if(matcher.find()){
System.out.println(matcher.group(1));
System.out.println(matcher.group(2));
System.out.println(matcher.group(3));
}
This feels pretty basic .
------ For reference only -------------------------------------- -
I date data type is a data type , how to take ah
------ For reference only ----------------- ----------------------
Pattern p = Pattern.compile ("
Matcher m = p.matcher (str);
while (m.find ()) {
n.setNews_Rq (m.group (3));
n.setNews_Title (m.group (2). replace (""", " \ " " ) ) ;
n.setNews_Url (m.group (1). replace ("\" ", ; " " ) ) ;
n.setNews_Id (n.getNews_Id () +1); ;
}
newsService.save (n);
This is what I wrote it myself, my definition of news_rq is date type , so did not get ah
------ For reference only ---------------------------------- -----
string into date does not have to ?
------ For reference only -------------------------------------- -
Thank you, ah, because just beginning to learn , so many do not know ah
------ For reference only ----------------- ----------------------

Here I how conversion ah , sorry ah, indeed many will not
------ For reference only -------------------- -------------------

I was doing, but when stored in the database will complain
------ For reference only -------------------- -------------------
yyyy-MM-dd in the middle of uppercase
------ For reference only ------ ---------------------------------
uppercase I have tried, still the same and if I do not save the date can be successful, save the date will complain
没有评论:
发表评论