RegexWars
Tier 1 · Sorcererextract

Quoted, With Escapes

Extract every double-quoted string, including its quotes, where a backslash escapes the next character.

This is the pattern at the heart of every hand-written lexer. The naive version stops at the first escaped quote it meets. The fix is to alternate: either an ordinary character, or a backslash and whatever follows it — never letting the loop see a bare quote.

Your pattern1 chars · par 18
//g
Flags
Start typing — tests run as you go.0 of 4 visible tests passing
Test cases
  • "simple"→ ["\"simple\""]
  • a "b\"c" d "e" f→ ["\"b\\\"c\"", "\"e\""]
  • no quotes→ []
  • "a" "b"→ ["\"a\"", "\"b\""]

+ 3 hidden tests, checked when you submit. They are what stops a pattern that only fits the examples above.