Reputation: 309
I want to separate that strings (only the strings in English) from this messed string:
"[[[\"Dude, that was insane! \",\"Cara, aquilo foi insano!\",null,null,3],[\"How did you do that? \",\"
I was trying to make a regex using Dart, but it doesn't match:
var regex = RegExp(r'[\"([\w+\s]*)\s\",\"');
Iterable<Match> matches = regex.allMatches(returnString)
matches.forEach((match) {
print(match.group(0));
});
FormatException: Unmatched ')'[\"([\w+.\s]*)\s\",\"
Can someone help me? How can I make a good regex? I'm new at it so sorry about my lack of knowledge.
Upvotes: 1
Views: 122
Reputation: 76213
You can use:
var regex = RegExp(r'"[^"]*"');
which will display:
"Dude, that was insane! "
"Cara, aquilo foi insano!"
"How did you do that? "
Note that your string looks really like a json string and if it is you should use json codec to decode it and recursively go through the tree to collect strings.
Upvotes: 1