I am trying to get information inside quotes in node.js
For example:
var information = 'Hello "beautiful and amazing" world.'
How can I log the content written inside the of the " "
?
I want to get this as result: beautiful and amazing
I am trying to get information inside quotes in node.js
For example:
var information = 'Hello "beautiful and amazing" world.'
How can I log the content written inside the of the " "
?
I want to get this as result: beautiful and amazing
Using regex:
var information = 'Hello "beautiful and amazing" world.'
var regex = /".+"/
var match = information.match(regex)
var res = match?.[0].slice(1, match[0].length - 1)
console.log("Result: " + res)
This checks for "
then any text, then another "
. Then it removes the "
s