Reputation: 4378
Hi I really don't understand Regular Expressions :P
This is the input string:
"{\"Name\", \"Surname\", \"Age\", \"Other string with letters and numbers\"}"
And this is the output array of strings that i want:
In other words, i have to eliminate "
, {
and ,
Upvotes: 0
Views: 1187
Reputation: 240976
String str = "{\"Name\", \"Surname\", \"Age\", \"Other string with letters and numbers\"}";
String strArr[] = str.replaceAll("\\}|\\{|\"", "").split(",");
for (String tmpStr : strArr) {
System.out.println(tmpStr);
}
Output:
Name
Surname
Age
Other string with letters and numbers
Upvotes: 1
Reputation: 8915
This will match all the terms you specify:
\"(.*?)\"
Working example: http://rubular.com/r/A91DetXakU
Upvotes: 4