fork download
  1. #!/bin/bash
  2. s='A culprit \" escaped quote and "String1 \"here\""
  3. "String2"'
  4. grep -oP '(?<!\\)(?:\\{2})*\K"[^"\\]*(?:\\.[^"\\]*)*"' <<< "$s";
Success #stdin #stdout 0s 4536KB
stdin
Standard input is empty
stdout
"String1 \"here\""
"String2"