Regular Expressions 101

Community Patterns

Javascript: howto get rid of resulting ""

2

Regular Expression
ECMAScript (JavaScript)

/
"{1}(.*?)"{1}
/
g

Description

Hey folks, I try to do smth like this: var s = 'this is a "" && "string constant" and this "is another" one', result = s.match(new RegExp('"{1}(.*?)"{1}', 'g'));

console.log(result);

what it gives me back is ["""", ""string constant"", ""is another""]. How can I get smth just like ["", "string constant", "is another"]?

Many thanks for any advice

Submitted by anonymous - 10 years ago