I have one string I want to find out all date values and relace them with specific string.
My code looks like:
String mydata = "{[... \"date\":\"2016-03-16T12:38:28.390Z\"]},{[ ... \"date\":\"2016-03-16T12:38:28.390Z\" ...]}";
Pattern pattern = Pattern.compile("");
Matcher matcher = pattern.matcher(mydata);
while(matcher.find()){
mydata = mydata.replace(matcher.group(), matcher.group().substring(0, 10));
}
System.out.println(mydata);
What string regex I should pass in Pattern.compile("");
?
My output should look like:
{[... "date":"2016-03-16"]},{[ ... "date":"2016-03-16" ...]}