নেগেটিভ লুকআহেড রেগেক্স /(?<=:)(?!(?:null|false|true|\d+),)[\w-]+(?=,)/g ব্যবহার করে শুধু ডিজিট নয় এমন স্ট্রিং ম্যাচ করা যায়।
উদাহরণ
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' ]