← Back to all regex patterns
Extraction
Low backtracking risk

Regex to Extract Quoted Text

Use this when you need content between double quotes while tolerating escaped characters in logs or config snippets.

Regex
/"([^"\\]*(?:\\.[^"\\]*)*)"/g

Try this pattern

Matches current input
He said "deploy now"

1 match found in the current text.

Passing examples

  • He said "deploy now"
  • "escaped \"quote\" ok"

Failing examples

  • no quotes here
  • 'single quotes only'

Code examples

JavaScript
const regex = /"([^"\\]*(?:\\.[^"\\]*)*)"/g;
regex.test(input);
Python
import re
pattern = re.compile(r""([^"\\]*(?:\\.[^"\\]*)*)"")
bool(pattern.search(input))
Go
re := regexp.MustCompile("\"([^\"\\\\]*(?:\\\\.[^\"\\\\]*)*)\"")
matched := re.MatchString(input)

Related Extraction Patterns