रेगेक्स में विशिष्ट शब्द मिलान करने के लिए, नियमित अभिव्यक्ति का उपयोग करें।
उदाहरण
कोड निम्न है:
var sentence = "This is the not javascript Tutorial"; var regularExpression = /\bjavascript\b/g; var output = regularExpression.test(sentence); console.log(output);
उपरोक्त प्रोग्राम को चलाने के लिए, आपको निम्न कमांड का उपयोग करना होगा:
node fileName.js.
यहां, मेरा फ़ाइल नाम demo308.js है।
आउटपुट
यह निम्न आउटपुट उत्पन्न करेगा:
PS C:\Users\Amit\javascript-code> node demo308.js true