उदाहरण
रेगुलर एक्सप्रेशन और इंडेक्स का उपयोग करके ब्रैकेट्स के बिना वैल्यू प्राप्त करें।
var regularExpression = /(?<=\[).*?(?=\])/g;
var getTheValueWithIndex = "[John Smith][David Miller]".match(regularExpression);
console.log("The first value without bracket=" + getTheValueWithIndex[0]);
console.log("The second value without bracket=" + getTheValueWithIndex[1]);
प्रोग्राम चलाने के लिए:
node fileName.js
आउटपुट
PS C:\Users\Amit\JavaScript-code> node demo132.js The first value without bracket=John Smith The second value without bracket=David Miller