String str = "{judgeDate:{\"$lte\":ISODate(\"2013-08-15T16:00:00Z\"), \"$lte\":ISODate(\"2011-08-15T16:00:00Z\")},caseaNO:1}"怎么样能把字符串解析成 字符串是瞎写的
judgeDate ; {\"$lte\":ISODate(\"2013-08-15T16:00:00Z\"), \"$lte\":ISODate(\"2011231-08-15T16:00:00Z\")
caseaNO:1
"$lte":ISODate(\"2013-08-15T16:00:00Z")
"$lte\":ISODate(\"2011-08-15T16:00:00Z\")求打什么指教 我都能弄块一周了~~~~
judgeDate ; {\"$lte\":ISODate(\"2013-08-15T16:00:00Z\"), \"$lte\":ISODate(\"2011231-08-15T16:00:00Z\")
caseaNO:1
"$lte":ISODate(\"2013-08-15T16:00:00Z")
"$lte\":ISODate(\"2011-08-15T16:00:00Z\")求打什么指教 我都能弄块一周了~~~~
---------- java ----------
"$lte":ISODate("2013-08-15T16:00:00Z")
"$lte":ISODate("2011-08-15T16:00:00Z")Output completed (0 sec consumed) - Normal Termination
import java.util.regex.Matcher;
import java.util.regex.Pattern;public class Test{
public static void main(String[] args){
String str = "{judgeDate:{\"$lte\":ISODate(\"2013-08-15T16:00:00Z\"), \"$lte\":ISODate(\"2011-08-15T16:00:00Z\")},caseaNO:1}";
String regex = "\"[^\"]+\":.+?\\(\"[^\"]+\"\\)";
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(str); while(matcher.find()){
System.out.println(matcher.group());
}
}
}