/^/
HardParsing

Quoted String With Escapes

Write a regex that matches a double-quoted string where escaped quotes (\") inside the string are allowed and don't end the match early, but an unescaped quote in the middle should not be permitted.

//
"hello" / "he said \"hi\"" / "unterminated / "bad " quote"

Test cases

  • "hello"expect match
  • "he said \"hi\""expect match
  • "unterminatedexpect no match
  • no quotesexpect no match
  • "back\\slash"expect match
  • "he said "hi""expect no match