How can i find a tag inside a document in Javascript : I want to find if the document(which is a html file) has "some" tag if so, i want to get all its attributes.

i tried with 

    var data = require('test.html');
    if(data.toLowerCase().indexOf('sometag')){
     console.log('yeaaah it exist'); 
    }

The problem is it always returns "true" whether the tag exists or not.








