1

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.

1
  • go to regexr.com and test your input and then use it in your code Commented Sep 20, 2018 at 4:20

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much! I used this pattern surrounded by '\B...\B' and it matchs!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.