I would like to get the text between double quotes using JavaScript. I found online something like title.match(/\".*?\"/); but the thing is that sometimes I hav
split() function can be used get value in double quote
let str1 = 'Neque "porro quisquam est" qui dolorem ipsum';
let str2 = 'Neque porro quisquam est qui dolorem ipsum';
function findFirstOccurance(str){
const matches = str.split('"');
return matches[1] ? matches[1] : str;
}
console.log(findFirstOccurance(str1));
console.log(findFirstOccurance(str2));