I wanted to select text within quotes using regex as per below scenario -
Regex should select text between the quotes. If there are nested quotes it should select all inner nested quotes instead of outer ones.
Ex 1 -
Sample.text.value "The quick brown fox"
Result should be - The quick brown fox
Ex 2 -
Sample.text.value "The quick brown fox" random text here one "jumps over the lazy dog" random text here two
Result should be - The quick brown fox and jumps over the lazy dog
Ex 3 -
"Sample.text.value "The quick brown fox" random text here one "jumps over the lazy dog" random text here two"
Result should be - The quick brown fox and jumps over the lazy dog
I am trying this regex "([^"]*)"
This works fine in first two cases. But in third case it does not select as expected.
It selects Sample.text.value and random text here one and random text here two.
But I need The quick brown fox and jumps over the lazy dog to be selected.
Is it possible via regex ?
(?<=")\S[^"]+\S(?=")
? – Onyambu