Regex to match "square brackets", "double quotes"

  Requirement: get 1,2,3 from the string ["1","2","3"]

  Method: think of many methods, you can replace it step by step. Here is a simpler method

String str = "[\"1\",\"2\",\"3\"]";

String reg = "[\\["\\]]";
str =  str.replaceAll(reg,"");

  result:

    str=“1,2,3”;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324471353&siteId=291194637