I'm trying to do a non-greedy capture of text inside double quotation marks with regex in node.js. Most of the Google results say I should use one of these:
"(.*?)"
"([^"]*)"
I tried both, but my code doesn't remove the quotes. My code looks so:
var testStr = '|> "Song" by "Artist" on "Album" <3';
var regex = /"([^"]*)"/g; // or /"(.*?)"/g
var info = testStr.match(regex);
if (info){
console.dir(info[0]);
console.dir(info[1]);
console.dir(info[2]);
}
My output is this:
'"Song"'
'"Artist"'
'"Album"'
What am I doing wrong?