1

I need to write a regular expression that stops at the first " not the last one.

For example if I check for 'list:".*"' and I have a string such as list:"dogs" it will work fine.

But if I have something like list:"dogs" "cats" that regex will catch the whole thing ending at the very last ". But I need to end the first time it sees the closing " after dog. How do I do this?

TheBandit
  • 109
  • 2
  • 9
  • You could do it one of two ways, non-greedy `list:".*?"` or greedy `list:"[^"]*"` –  Sep 07 '16 at 21:42

0 Answers0