Regular Expressions 101

Community Patterns

Community Library Entry

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