उदाहरण
रेगुलर एक्सप्रेशन का उपयोग करके नॉन-डिजिट स्ट्रिंग्स मैच करें।
var regularExpression = /(?<=:)(?!(?:null|false|true|\d+),)[\w-]+(?=,)/g;
var values = 'studentId:"100001",studentName:"John Smith",isTopper:true,uniqueId:10001J-10001,marks:78,newId:"4678"';
console.log("Original Value=" + values);
console.log("The string that are not entirely digits=");
console.log(values.match(regularExpression));
प्रोग्राम चलाने के लिए:
node fileName.js
आउटपुट
PS C:\Users\Amit\javascript-code> node demo187.js Original Value=studentId:"100001",studentName:"John Smith",isTopper:true,uniqueId:10001J-10001,marks:78,newId:"4678" The string that are not entirely digits= [ '10001J-10001' ]