Obtenga valores dentro de comillas en javascript, como en discord dyno bot uses ?poll "<title>" "<choice>" "<choice>" , ¿Cómo divido la matriz para obtener los valores del título y las opciones en javascript?
1) Puede lograr fácilmente el resultado usando expresiones regulares
/(?<=")[^"]+/ const str = `?poll "<title>" "<choice>" "<choice>"`; const result = str.match(/(?<=")[^"]+/g).filter((s) => s.trim()); console.log(result);2) Si no se admite lookbehind, puede hacer lo siguiente:
/"[^"]+/ const str = `?poll "<title>" "<choice>" "<choice>"`; const result = str .match(/"[^"]+/g) .map((s) => s.slice(1)) .filter((s) => s.trim()); console.log(result);