Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • 17
    This is great, however it does not handle strings with escaped quotes. e.g., "hello \" world" Commented Feb 5, 2015 at 20:01
  • 1
    Using JavaScript's match, this will match the quotation marks as well. It will work with iterating over exec as described here: stackoverflow.com/questions/7998180/… Commented Apr 27, 2016 at 12:22
  • 9
    @robbyt I know it's a bit late for a reply but, what about a negative lookbehind? "(.*?(?<!\\))" Commented Jul 7, 2017 at 18:39
  • 6
    Thank you - this is simpler if you are sure there are no escaped quotes to deal with. Commented Dec 2, 2017 at 19:17
  • 1
    Simple and effective! Commented Sep 24, 2020 at 22:23